亚洲欧美第一页_禁久久精品乱码_粉嫩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一区二区三区免费野_久草精品视频
午夜视频在线观看一区二区三区| 国产色91在线| 亚洲丝袜精品丝袜在线| 在线日韩一区二区| 欧美一级黄色录像| 欧美久久婷婷综合色| 欧美日韩综合在线免费观看| 这里只有精品电影| 免费国产亚洲视频| 99视频精品在线| 国产精品一品二品| 国产成人在线色| 成人国产精品免费网站| 成人国产精品免费观看动漫| 99在线精品一区二区三区| 99国产精品久久久久久久久久久| 色悠久久久久综合欧美99| 色噜噜狠狠一区二区三区果冻| 欧美午夜免费电影| 在线不卡中文字幕| 亚洲精品在线电影| 中文字幕av一区二区三区| 亚洲柠檬福利资源导航| 亚洲国产婷婷综合在线精品| 蜜臀久久久久久久| 国产乱码一区二区三区| 成人h动漫精品| 在线成人午夜影院| 国产视频视频一区| 一区二区三区精密机械公司| 另类调教123区| youjizz国产精品| 91麻豆精品一区二区三区| 9191成人精品久久| 久久综合狠狠综合久久综合88 | 日本一区二区三区久久久久久久久不| 国产精品久久久久久久久免费桃花 | 亚洲精品国产品国语在线app| 亚洲成av人片在线| 国产69精品久久99不卡| 欧美视频在线一区二区三区| 国产亚洲精久久久久久| 亚洲国产精品麻豆| 床上的激情91.| 日韩一级视频免费观看在线| 一区精品在线播放| 久久91精品久久久久久秒播| 91小视频在线免费看| 精品99久久久久久| 一区二区三区日韩在线观看| 国产自产2019最新不卡| 欧美中文字幕一区二区三区亚洲| 久久久精品免费观看| 日日骚欧美日韩| 91小视频在线观看| 久久精品日韩一区二区三区| 日本成人在线不卡视频| 欧美性一区二区| 亚洲欧美自拍偷拍| 国产99久久久久| 久久综合九色综合97_久久久| 午夜久久久久久久久| 91极品美女在线| 亚洲欧洲日韩综合一区二区| 国产精品主播直播| 欧美成人猛片aaaaaaa| 天堂蜜桃一区二区三区| 欧美图片一区二区三区| 亚洲欧美偷拍另类a∨色屁股| 国产盗摄视频一区二区三区| 久久综合色播五月| 九色综合狠狠综合久久| 日韩久久久久久| 美国欧美日韩国产在线播放| 制服丝袜亚洲播放| 丝袜亚洲另类欧美综合| 欧美日韩视频专区在线播放| 午夜在线电影亚洲一区| 欧美吻胸吃奶大尺度电影| 亚洲一二三四在线| 欧美性色黄大片手机版| 五月婷婷色综合| 91精品国产综合久久精品麻豆| 天堂蜜桃一区二区三区| 777亚洲妇女| 麻豆精品在线看| 久久亚洲免费视频| 国产精品一区二区91| 一区在线观看免费| 欧美色倩网站大全免费| 日韩国产在线观看一区| 26uuu久久综合| 成人av网址在线| 一区二区三区欧美亚洲| 欧美三级蜜桃2在线观看| 免费在线一区观看| 久久婷婷国产综合国色天香| 大美女一区二区三区| 自拍av一区二区三区| 欧美午夜精品免费| 久久97超碰国产精品超碰| 亚洲国产成人午夜在线一区| 色欧美乱欧美15图片| 日本欧美久久久久免费播放网| 精品日韩在线观看| 91麻豆国产自产在线观看| 日日夜夜免费精品| 国产精品你懂的在线欣赏| 在线免费不卡电影| 韩国理伦片一区二区三区在线播放| 中文字幕精品在线不卡| 精品视频在线视频| 国产福利一区二区| 亚洲超碰精品一区二区| 国产欧美一区二区精品仙草咪 | 亚洲一区二区三区四区在线 | 日韩午夜av电影| 成人夜色视频网站在线观看| 亚洲国产精品久久一线不卡| 久久久久久毛片| 欧美年轻男男videosbes| 国产成人av电影在线观看| 亚洲午夜久久久久中文字幕久| 久久精品一二三| 欧美精品三级日韩久久| 成人av电影在线播放| 久久99国产乱子伦精品免费| 亚洲一级二级三级| 国产精品另类一区| 日韩欧美的一区| 欧美午夜电影网| 色呦呦日韩精品| 不卡电影一区二区三区| 久久国内精品自在自线400部| 一区二区不卡在线播放| 成人免费在线视频观看| 国产日韩欧美综合一区| 精品免费视频一区二区| 在线成人av影院| 欧美视频一区二区三区| 91免费在线播放| av午夜精品一区二区三区| 国产精品99久久久久久久女警| 日韩不卡一区二区三区| 香蕉久久夜色精品国产使用方法| 亚洲裸体xxx| 亚洲男人天堂av网| 国产精品你懂的在线欣赏| 国产日韩欧美精品在线| 久久亚洲精华国产精华液 | 9i在线看片成人免费| 国产福利91精品| 国产精品一区二区三区99| 久久国产夜色精品鲁鲁99| 日本三级韩国三级欧美三级| 日韩高清欧美激情| 日本不卡免费在线视频| 麻豆精品在线观看| 国产在线播放一区三区四| 精品制服美女丁香| 国产在线视视频有精品| 国产一区二区三区精品欧美日韩一区二区三区 | 色综合中文字幕国产 | 一区二区三区自拍| 亚洲欧美偷拍三级| 一区二区三区在线视频播放| 亚洲午夜国产一区99re久久| 日日欢夜夜爽一区| 看电影不卡的网站| 国产高清久久久久| 色综合久久久久综合| 欧美日韩你懂的| 日韩欧美激情四射| 精品sm在线观看| 亚洲欧洲日韩一区二区三区| 亚洲自拍欧美精品| 免费精品视频最新在线| 国产传媒日韩欧美成人| 日本精品裸体写真集在线观看 | 成人av中文字幕| 色天使色偷偷av一区二区| 91精品国产乱码久久蜜臀| 久久亚洲欧美国产精品乐播| 亚洲同性gay激情无套| 丝袜亚洲另类欧美综合| 国产成人亚洲精品青草天美| 色综合中文字幕| 精品少妇一区二区三区免费观看| 国产精品久久久久久久裸模| 天天色图综合网| 国产一区在线观看视频| 在线观看日韩毛片| 久久婷婷一区二区三区| 亚洲国产精品一区二区尤物区| 麻豆国产欧美日韩综合精品二区| 成人免费毛片高清视频| 91精品国产综合久久精品性色| 国产精品女同互慰在线看| 青娱乐精品在线视频| 99re视频精品|