亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? netcam.c

?? motion motion
?? C
?? 第 1 頁 / 共 5 頁
字號:
/* *      netcam.c * *      Module for handling network cameras. * *      This code was inspired by the original netcam.c module *      written by Jeroen Vreeken and enhanced by several Motion *      project contributors, particularly Angel Carpintero and *      Christopher Price. * *      Copyright 2005, William M. Brack *      This software is distributed under the GNU Public license *      Version 2.  See also the file 'COPYING'. * * *      When a netcam has been configured, instead of using the routines *      within video.c (which handle a CCTV-type camera) the routines *      within this module are used.  There are only four entry points - *      one for "starting up" the camera (netcam_start), for "fetching a *      picture" from it (netcam_next), one for cleanup at the end of a *      run (netcam_cleanup), and a utility routine for receiving data *      from the camera (netcam_recv). * *      Two quite different types of netcams are handled.  The simplest *      one is the type which supplies a single JPEG frame each time it *      is accessed.  The other type is one which supplies an mjpeg *      stream of data. * *      For each of these cameras, the routine taking care of the netcam *      will start up a completely separate thread (which I call the "camera *      handler thread" within subsequent comments).  For a streaming camera, *      this handler will receive the mjpeg stream of data from the camera, *      and save the latest complete image when it begins to work on the next *      one.  For the non-streaming version, this handler will be "triggered" *      (signalled) whenever the main motion-loop asks for a new image, and *      will start to fetch the next image at that time.  For either type, *      the most recent image received from the camera will be returned to *      motion. */#include "motion.h"#include <netdb.h>#include <netinet/in.h>#include <regex.h>                  /* For parsing of the URL *///#include <stdio.h>//#include <stdlib.h>//#include <string.h>#include <sys/socket.h>//#include <sys/types.h>#include "netcam_ftp.h"#define CONNECT_TIMEOUT        10   /* timeout on remote connection attempt */#define READ_TIMEOUT            5   /* default timeout on recv requests */#define POLLING_TIMEOUT  READ_TIMEOUT /* file polling timeout [s] */#define POLLING_TIME  500*1000*1000 /* file polling time quantum [ns] (500ms) */#define MAX_HEADER_RETRIES      5   /* Max tries to find a header record */#define MINVAL(x, y) ((x) < (y) ? (x) : (y))/* * The macro NETCAM_DEBUG is for development testing of this module. * The macro SETUP is to assure that "configuration-setup" type messages * are also printed when NETCAM_DEBUG is set.  Set the following #if to * 1 to enable it, or 0 (normal setting) to disable it. */#define SETUP    ((cnt->conf.setup_mode) || (debug_level >= CAMERA_INFO))tfile_context *file_new_context(void);void file_free_context(tfile_context* ctxt);/* These strings are used for the HTTP connection */static const char    *connect_req;static const char    *connect_req_http10 = "GET %s HTTP/1.0\r\n"                      "Host: %s\r\n"                      "User-Agent: Motion-netcam/" VERSION "\r\n";static const char    *connect_req_http11 = "GET %s HTTP/1.1\r\n"                      "Host: %s\r\n"                      "User-Agent: Motion-netcam/" VERSION "\r\n";static const char    *connect_req_close = "Connection: close\r\n";static const char    *connect_req_keepalive = "Connection: Keep-Alive\r\n";static const char    *connect_auth_req = "Authorization: Basic %s\r\n";/* * The following three routines (netcam_url_match, netcam_url_parse and * netcam_url_free are for 'parsing' (i.e. separating into the relevant * components) the URL provided by the user.  They make use of regular * expressions (which is outside the scope of this module, so detailed * comments are not provided).  netcam_url_parse is called from netcam_start, * and puts the "broken-up" components of the URL into the "url" element of * the netcam_context structure. * * Note that the routines are not "very clever", but they work sufficiently * well for the limited requirements of this module.  The expression: *   (http)://(((.*):(.*))@)?([^/:]|[-.a-z0-9]+)(:([0-9]+))?($|(/[^:]*)) * requires *   1) a string which begins with 'http', followed by '://' *   2) optionally a '@' which is preceded by two strings *      (with 0 or more characters each) separated by a ':' *      [this is for an optional username:password] *   3) a string comprising alpha-numerics, '-' and '.' characters *      [this is for the hostname] *   4) optionally a ':' followed by one or more numeric characters *      [this is for an optional port number] *   5) finally, either an end of line or a series of segments, *      each of which begins with a '/', and contains anything *      except a ':' *//** * netcam_url_match * *      Finds the matched part of a regular expression * * Parameters: * *      m          A structure containing the regular expression to be used *      input      The input string * * Returns:        The string which was matched * */static char *netcam_url_match(regmatch_t m, const char *input){	char *match = NULL;	int len;	if (m.rm_so != -1) {		len = m.rm_eo - m.rm_so;		if ((match = (char *) malloc(len + 1)) != NULL) {			strncpy(match, input + m.rm_so, len);			match[len] = '\0';		}	}	return (match);}/** * netcam_url_parse * *      parses a string containing a URL into it's components * * Parameters: *      parse_url          A structure which will receive the results *                         of the parsing *      text_url           The input string containing the URL * * Returns:                Nothing * */static void netcam_url_parse(struct url_t *parse_url, const char *text_url){	char *s;	int i;	const char *re = "(http|ftp)://(((.*):(.*))@)?"	                 "([^/:]|[-.a-z0-9]+)(:([0-9]+))?($|(/[^:]*))";	regex_t pattbuf;	regmatch_t matches[10];	if( !strncmp( text_url, "file", 4 ) ) 		re = "(file)://(((.*):(.*))@)?"		     "([^/:]|[-.a-z0-9]*)(:([0-9]*))?($|(/[^:][/-_.a-z0-9]+))";	if (debug_level > CAMERA_DEBUG)		motion_log(-1, 0, "Entry netcam_url_parse data %s", text_url );	memset(parse_url, 0, sizeof(struct url_t));	/*	 * regcomp compiles regular expressions into a form that is	 * suitable for regexec searches	 * regexec matches the URL string against the regular expression	 * and returns an array of pointers to strings matching each match	 * within (). The results that we need are finally placed in parse_url	 */	if (!regcomp(&pattbuf, re, REG_EXTENDED | REG_ICASE)) {		if (regexec(&pattbuf, text_url, 10, matches, 0) != REG_NOMATCH) {			for (i = 0; i < 10; i++) {				if ((s = netcam_url_match(matches[i], text_url)) != NULL) {					if (debug_level > CAMERA_DEBUG)						motion_log(-1, 0, "Parse case %d data %s", i, s );					switch (i) {						case 1:							parse_url->service = s;							break;						case 3:							parse_url->userpass = s;							break;						case 6:							parse_url->host = s;							break;						case 8:							parse_url->port = atoi(s);							free(s);							break;						case 9:							parse_url->path = s;							break;						/* other components ignored */						default:							free(s);							break;					}				}			}		}	}	if ((!parse_url->port) && (parse_url->service)){		if (!strcmp(parse_url->service, "http"))			parse_url->port = 80;		else if (!strcmp(parse_url->service, "ftp"))			parse_url->port = 21;	}	regfree(&pattbuf);}/** * netcam_url_free * *      General cleanup of the URL structure, called from netcam_cleanup. * * Parameters: * *      parse_url       Structure containing the parsed data * * Returns:             Nothing * */static void netcam_url_free(struct url_t *parse_url){	if (parse_url->service) {		free(parse_url->service);		parse_url->service = NULL;	}	if (parse_url->userpass) {		free(parse_url->userpass);		parse_url->userpass = NULL;	}	if (parse_url->host) {		free(parse_url->host);		parse_url->host = NULL;	}	if (parse_url->path) {		free(parse_url->path);		parse_url->path = NULL;	}}/** * check_quote * *      Checks a string to see if it's quoted, and if so removes the *      quotes. * * Parameters: * *      str             Pointer to a string * * Returns:             Nothing, but updates the target if necessary * */static void check_quote(char *str){	int len;	char ch;	ch = *str;	if ((ch == '"') || (ch == '\'')) {		len = strlen(str) - 1;		if (str[len] == ch) {			memmove(str, str+1, len-1);			str[len-1] = 0;		}	}}/** * netcam_check_content_length * * 	Analyse an HTTP-header line to see if it is a Content-length * * Parameters: * *      header          Pointer to a string containing the header line * * Returns: *      -1              Not a Content-length line *      >=0             Value of Content-length field * */static long netcam_check_content_length(char *header){	long length=-1;	/* note this is a long, not an int */	if (!header_process(header, "Content-Length", header_extract_number, &length)) {		/*		 * Some netcams deliver some bad-format data, but if		 * we were able to recognize the header section and the		 * number we might as well try to use it.		 */		if (length > 0)			return length;		return -1;	}	return length;}/** * netcam_check_keepalive * * 	Analyse an HTTP-header line to see if it is a Keep-Alive. * * Parameters: * *      header          Pointer to a string containing the header line * * Returns: *      -1              Not a Keep-Alive line *      1               Is a Keep-Alive line * */static int netcam_check_keepalive(char *header){	char *content_type = NULL;	if (!header_process(header, "Keep-Alive", http_process_type, &content_type))		return -1;	/* We do not detect the second field or other case mixes at present. */	if (content_type) 		free(content_type);	return 1;}/** * netcam_check_close * * 	Analyse an HTTP-header line to see if it is a Connection: close * * Parameters: * *      header          Pointer to a string containing the header line * * Returns: *      -1              Not a Connection: close *      1               Is a Connection: close * */static int netcam_check_close(char *header){	char *type = NULL;	int ret=-1;	if (!header_process(header, "Connection", http_process_type, &type))		return -1;		if (!strcmp(type, "close")) /* strcmp returns 0 for match */		ret=1;		if (type) 		free(type);	return ret;}/** * netcam_check_content_type * * 	Analyse an HTTP-header line to see if it is a Content-type * * Parameters: * *      header          Pointer to a string containing the header line * * Returns: *      -1              Not a Content-type line *      0               Content-type not recognized *      1               image/jpeg *      2               multipart/x-mixed-replace or multipart/mixed * */static int netcam_check_content_type(char *header){	char *content_type = NULL;	int ret;	if (!header_process(header, "Content-type", http_process_type, &content_type))		return -1;	if (!strcmp(content_type, "image/jpeg")) {		ret = 1;	} else if (!strcmp(content_type, "multipart/x-mixed-replace") ||	           !strcmp(content_type, "multipart/mixed")) {		ret = 2;	} else		ret = 0;	if (content_type)		free(content_type);	return ret;}/** * netcam_read_next_header

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久久久免费| 99热在这里有精品免费| 一区二区三区在线观看网站| 国产精品网站在线观看| 久久这里只有精品首页| 久久久精品天堂| 国产欧美日韩中文久久| 中文av一区二区| 国产精品成人一区二区三区夜夜夜| 中文字幕不卡的av| 亚洲视频在线一区二区| 亚洲一区二区精品视频| 亚洲电影激情视频网站| 日日摸夜夜添夜夜添亚洲女人| 日韩av成人高清| 国产大陆亚洲精品国产| 99久久er热在这里只有精品15| 91一区二区在线观看| 欧美三级电影在线观看| 日韩视频永久免费| 国产午夜久久久久| 亚洲欧美日韩国产综合在线| 午夜视频在线观看一区| 久久精品亚洲乱码伦伦中文| 亚洲国产精品99久久久久久久久| 久久这里只有精品6| 国产欧美精品一区二区色综合| 国产精品久久二区二区| 亚洲在线成人精品| 国产麻豆午夜三级精品| 99re在线精品| 欧美大片一区二区| 国产精品天干天干在线综合| 午夜精品一区二区三区免费视频| 九九精品一区二区| 色呦呦一区二区三区| 精品国产电影一区二区| 亚洲视频你懂的| 激情久久五月天| 欧美综合视频在线观看| 91精品国产综合久久久久久久久久| 欧美精品乱码久久久久久按摩| 精品少妇一区二区三区在线播放| 国产精品国产三级国产a| 麻豆高清免费国产一区| 92国产精品观看| 久久久久久久久免费| 亚洲成人1区2区| 91亚洲精品久久久蜜桃| 久久影视一区二区| 日韩av一二三| 欧美日韩一区国产| 亚洲人午夜精品天堂一二香蕉| 久久99精品国产.久久久久| 色香蕉久久蜜桃| 欧美国产精品一区| 韩国欧美一区二区| 欧美一级淫片007| 一区二区三区四区不卡视频| 成人午夜电影网站| 精品欧美久久久| 免费人成精品欧美精品| 欧美中文字幕一二三区视频| 亚洲青青青在线视频| 99国产精品99久久久久久| 国产亚洲欧美一区在线观看| 国产一区在线观看视频| 日韩女同互慰一区二区| 蜜臀久久久久久久| 在线不卡中文字幕| 午夜a成v人精品| 欧美日韩大陆在线| 亚洲成av人影院在线观看网| 欧美性淫爽ww久久久久无| 亚洲欧美日韩一区二区三区在线观看| 粉嫩13p一区二区三区| 国产目拍亚洲精品99久久精品| 国产伦精品一区二区三区免费| 久久不见久久见中文字幕免费| 欧美性感一区二区三区| 亚洲精品一二三四区| 色婷婷av一区二区三区gif| 亚洲天堂a在线| 99久久精品情趣| 亚洲精品日日夜夜| 欧美剧情电影在线观看完整版免费励志电影| 亚洲视频中文字幕| 欧美日本在线视频| 丝袜美腿亚洲一区二区图片| 91精品欧美综合在线观看最新| 日本成人在线一区| 精品88久久久久88久久久| 国产成人亚洲综合a∨猫咪| 国产精品久久久久一区| 欧美在线短视频| 免费精品99久久国产综合精品| 26uuu国产在线精品一区二区| 大陆成人av片| 亚洲成人av电影在线| 欧美精品一区二区久久久| 成人性生交大片| 亚洲一区二区精品3399| 精品99久久久久久| 色悠悠亚洲一区二区| 天天av天天翘天天综合网色鬼国产| 日韩三级av在线播放| 不卡av免费在线观看| 亚洲第一福利视频在线| 2024国产精品视频| 在线观看成人小视频| 精品在线一区二区三区| 亚洲日本在线看| 精品国产乱码久久久久久免费| 99久久精品99国产精品| 另类小说视频一区二区| 国产精品国产三级国产普通话99 | 欧美主播一区二区三区美女| 美女视频黄 久久| 亚洲欧洲日产国码二区| 欧美成人乱码一区二区三区| 91色九色蝌蚪| 国产在线国偷精品免费看| 一区二区欧美精品| 国产日韩欧美麻豆| 日韩视频免费观看高清完整版| 99在线精品视频| 国产一区二区三区蝌蚪| 丝袜美腿亚洲色图| 亚洲自拍欧美精品| 国产精品理伦片| 久久色中文字幕| 337p亚洲精品色噜噜噜| 99久久精品国产网站| 国产成人在线看| 久久国产欧美日韩精品| 五月婷婷色综合| 亚洲综合在线观看视频| 最近日韩中文字幕| 欧美激情一区不卡| 国产日韩欧美精品电影三级在线| 91精品在线麻豆| 在线91免费看| 欧美日本一区二区三区| 欧美熟乱第一页| 在线免费精品视频| 91精品1区2区| 一本大道av一区二区在线播放| 成人性生交大片| 欧美日韩成人综合| 日本精品裸体写真集在线观看| 成人av免费在线观看| 成人性色生活片| 国产精品白丝av| 丁香五精品蜜臀久久久久99网站| 国产九九视频一区二区三区| 九一久久久久久| 国产一区亚洲一区| 国产成人av影院| 99久久综合精品| 一本色道a无线码一区v| 欧美性猛片xxxx免费看久爱| 欧美专区日韩专区| 7777精品伊人久久久大香线蕉超级流畅| 欧美日韩一区二区三区免费看| 欧美主播一区二区三区| 欧美一区二区三区性视频| 欧美mv日韩mv| 国产精品久久久久久久久久免费看 | 亚洲国产精品久久不卡毛片| 亚洲国产精品一区二区尤物区| 亚洲国产日日夜夜| 青青草97国产精品免费观看 | 欧美一区二区视频在线观看2020| 欧美一区二区三区日韩| 久久午夜免费电影| 亚洲欧洲国产日韩| 亚洲小少妇裸体bbw| 韩国精品主播一区二区在线观看| 成年人国产精品| 欧美日本一区二区在线观看| 26uuu欧美| 亚洲精品一卡二卡| 九九精品一区二区| 色婷婷激情久久| 欧美一区二区三区在线看| 国产午夜亚洲精品午夜鲁丝片| 亚洲欧美激情小说另类| 久热成人在线视频| 91首页免费视频| 欧美成人欧美edvon| 一区二区三区高清在线| 精品一区二区免费在线观看| 色悠悠亚洲一区二区| 精品国产99国产精品| 一区二区三区精品在线| 国模一区二区三区白浆| 欧美日韩视频第一区| 亚洲欧洲成人自拍| 国内外成人在线视频| 欧美日韩综合在线免费观看|