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

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

?? wps_upnp_ssdp.c

?? 最新的Host AP 新添加了許多pcmcia 的驅動
?? C
?? 第 1 頁 / 共 2 頁
字號:
/* * UPnP SSDP for WPS * Copyright (c) 2000-2003 Intel Corporation * Copyright (c) 2006-2007 Sony Corporation * Copyright (c) 2008-2009 Atheros Communications * Copyright (c) 2009, Jouni Malinen <j@w1.fi> * * See wps_upnp.c for more details on licensing and code history. */#include "includes.h"#include <fcntl.h>#include <sys/ioctl.h>#include <net/route.h>#include "common.h"#include "uuid.h"#include "eloop.h"#include "wps.h"#include "wps_upnp.h"#include "wps_upnp_i.h"#define UPNP_CACHE_SEC (UPNP_CACHE_SEC_MIN + 1) /* cache time we use */#define UPNP_CACHE_SEC_MIN 1800 /* min cachable time per UPnP standard */#define UPNP_ADVERTISE_REPEAT 2 /* no more than 3 */#define MULTICAST_MAX_READ 1600 /* max bytes we'll read for UPD request */#define MAX_MSEARCH 20          /* max simultaneous M-SEARCH replies ongoing */#define SSDP_TARGET  "239.0.0.0"#define SSDP_NETMASK "255.0.0.0"/* Check tokens for equality, where tokens consist of letters, digits, * underscore and hyphen, and are matched case insensitive. */static int token_eq(const char *s1, const char *s2){	int c1;	int c2;	int end1 = 0;	int end2 = 0;	for (;;) {		c1 = *s1++;		c2 = *s2++;		if (isalpha(c1) && isupper(c1))			c1 = tolower(c1);		if (isalpha(c2) && isupper(c2))			c2 = tolower(c2);		end1 = !(isalnum(c1) || c1 == '_' || c1 == '-');		end2 = !(isalnum(c2) || c2 == '_' || c2 == '-');		if (end1 || end2 || c1 != c2)			break;	}	return end1 && end2; /* reached end of both words? */}/* Return length of token (see above for definition of token) */static int token_length(const char *s){	const char *begin = s;	for (;; s++) {		int c = *s;		int end = !(isalnum(c) || c == '_' || c == '-');		if (end)			break;	}	return s - begin;}/* return length of interword separation. * This accepts only spaces/tabs and thus will not traverse a line * or buffer ending. */static int word_separation_length(const char *s){	const char *begin = s;	for (;; s++) {		int c = *s;		if (c == ' ' || c == '\t')			continue;		break;	}	return s - begin;}/* No. of chars through (including) end of line */static int line_length(const char *l){	const char *lp = l;	while (*lp && *lp != '\n')		lp++;	if (*lp == '\n')		lp++;	return lp - l;}/* No. of chars excluding trailing whitespace */static int line_length_stripped(const char *l){	const char *lp = l + line_length(l);	while (lp > l && !isgraph(lp[-1]))		lp--;	return lp - l;}static int str_starts(const char *str, const char *start){	return os_strncmp(str, start, os_strlen(start)) == 0;}/*************************************************************************** * Advertisements. * These are multicast to the world to tell them we are here. * The individual packets are spread out in time to limit loss, * and then after a much longer period of time the whole sequence * is repeated again (for NOTIFYs only). **************************************************************************//** * next_advertisement - Build next message and advance the state machine * @a: Advertisement state * @islast: Buffer for indicating whether this is the last message (= 1) * Returns: The new message (caller is responsible for freeing this) * * Note: next_advertisement is shared code with msearchreply_* functions */static struct wpabuf *next_advertisement(struct advertisement_state_machine *a, int *islast){	struct wpabuf *msg;	char *NTString = "";	char uuid_string[80];	*islast = 0;	uuid_bin2str(a->sm->wps->uuid, uuid_string, sizeof(uuid_string));	msg = wpabuf_alloc(800); /* more than big enough */	if (msg == NULL)		goto fail;	switch (a->type) {	case ADVERTISE_UP:	case ADVERTISE_DOWN:		NTString = "NT";		wpabuf_put_str(msg, "NOTIFY * HTTP/1.1\r\n");		wpabuf_printf(msg, "HOST: %s:%d\r\n",			      UPNP_MULTICAST_ADDRESS, UPNP_MULTICAST_PORT);		wpabuf_printf(msg, "CACHE-CONTROL: max-age=%d\r\n",			      UPNP_CACHE_SEC);		wpabuf_printf(msg, "NTS: %s\r\n",			      (a->type == ADVERTISE_UP ?			       "ssdp:alive" : "ssdp:byebye"));		break;	case MSEARCH_REPLY:		NTString = "ST";		wpabuf_put_str(msg, "HTTP/1.1 200 OK\r\n");		wpabuf_printf(msg, "CACHE-CONTROL: max-age=%d\r\n",			      UPNP_CACHE_SEC);		wpabuf_put_str(msg, "DATE: ");		format_date(msg);		wpabuf_put_str(msg, "\r\n");		wpabuf_put_str(msg, "EXT:\r\n");		break;	}	if (a->type != ADVERTISE_DOWN) {		/* Where others may get our XML files from */		wpabuf_printf(msg, "LOCATION: http://%s:%d/%s\r\n",			      a->sm->ip_addr_text, a->sm->web_port,			      UPNP_WPS_DEVICE_XML_FILE);	}	/* The SERVER line has three comma-separated fields:	 *      operating system / version	 *      upnp version	 *      software package / version	 * However, only the UPnP version is really required, the	 * others can be place holders... for security reasons	 * it is better to NOT provide extra information.	 */	wpabuf_put_str(msg, "SERVER: Unspecified, UPnP/1.0, Unspecified\r\n");	switch (a->state / UPNP_ADVERTISE_REPEAT) {	case 0:		wpabuf_printf(msg, "%s: upnp:rootdevice\r\n", NTString);		wpabuf_printf(msg, "USN: uuid:%s::upnp:rootdevice\r\n",			      uuid_string);		break;	case 1:		wpabuf_printf(msg, "%s: uuid:%s\r\n", NTString, uuid_string);		wpabuf_printf(msg, "USN: uuid:%s\r\n", uuid_string);		break;	case 2:		wpabuf_printf(msg, "%s: urn:schemas-wifialliance-org:device:"			      "WFADevice:1\r\n", NTString);		wpabuf_printf(msg, "USN: uuid:%s::urn:schemas-wifialliance-"			      "org:device:WFADevice:1\r\n", uuid_string);		break;	case 3:		wpabuf_printf(msg, "%s: urn:schemas-wifialliance-org:service:"			      "WFAWLANConfig:1\r\n", NTString);		wpabuf_printf(msg, "USN: uuid:%s::urn:schemas-wifialliance-"			      "org:service:WFAWLANConfig:1\r\n", uuid_string);		break;	}	wpabuf_put_str(msg, "\r\n");	if (a->state + 1 >= 4 * UPNP_ADVERTISE_REPEAT)		*islast = 1;	return msg;fail:	wpabuf_free(msg);	return NULL;}static void advertisement_state_machine_handler(void *eloop_data,						void *user_ctx);/** * advertisement_state_machine_stop - Stop SSDP advertisements * @sm: WPS UPnP state machine from upnp_wps_device_init() */void advertisement_state_machine_stop(struct upnp_wps_device_sm *sm){	eloop_cancel_timeout(advertisement_state_machine_handler, NULL, sm);}static void advertisement_state_machine_handler(void *eloop_data,						void *user_ctx){	struct upnp_wps_device_sm *sm = user_ctx;	struct advertisement_state_machine *a = &sm->advertisement;	struct wpabuf *msg;	int next_timeout_msec = 100;	int next_timeout_sec = 0;	struct sockaddr_in dest;	int islast = 0;	/*	 * Each is sent twice (in case lost) w/ 100 msec delay between;	 * spec says no more than 3 times.	 * One pair for rootdevice, one pair for uuid, and a pair each for	 * each of the two urns.	 * The entire sequence must be repeated before cache control timeout	 * (which  is min  1800 seconds),	 * recommend random portion of half of the advertised cache control age	 * to ensure against loss... perhaps 1800/4 + rand*1800/4 ?	 * Delay random interval < 100 msec prior to initial sending.	 * TTL of 4	 */	wpa_printf(MSG_MSGDUMP, "WPS UPnP: Advertisement state=%d", a->state);	msg = next_advertisement(a, &islast);	if (msg == NULL)		return;	os_memset(&dest, 0, sizeof(dest));	dest.sin_family = AF_INET;	dest.sin_addr.s_addr = inet_addr(UPNP_MULTICAST_ADDRESS);	dest.sin_port = htons(UPNP_MULTICAST_PORT);	if (sendto(sm->multicast_sd, wpabuf_head(msg), wpabuf_len(msg), 0,		   (struct sockaddr *) &dest, sizeof(dest)) == -1) {		wpa_printf(MSG_ERROR, "WPS UPnP: Advertisement sendto failed:"			   "%d (%s)", errno, strerror(errno));		next_timeout_msec = 0;		next_timeout_sec = 10; /* ... later */	} else if (islast) {		a->state = 0; /* wrap around */		if (a->type == ADVERTISE_DOWN) {			wpa_printf(MSG_DEBUG, "WPS UPnP: ADVERTISE_DOWN->UP");			a->type = ADVERTISE_UP;			/* do it all over again right away */		} else {			u16 r;			/*			 * Start over again after a long timeout			 * (see notes above)			 */			next_timeout_msec = 0;			os_get_random((void *) &r, sizeof(r));			next_timeout_sec = UPNP_CACHE_SEC / 4 +				(((UPNP_CACHE_SEC / 4) * r) >> 16);			sm->advertise_count++;			wpa_printf(MSG_DEBUG, "WPS UPnP: ADVERTISE_UP (#%u); "				   "next in %d sec",				   sm->advertise_count, next_timeout_sec);		}	} else {		a->state++;	}	wpabuf_free(msg);	eloop_register_timeout(next_timeout_sec, next_timeout_msec,			       advertisement_state_machine_handler, NULL, sm);}/** * advertisement_state_machine_start - Start SSDP advertisements * @sm: WPS UPnP state machine from upnp_wps_device_init() * Returns: 0 on success, -1 on failure */int advertisement_state_machine_start(struct upnp_wps_device_sm *sm){	struct advertisement_state_machine *a = &sm->advertisement;	int next_timeout_msec;	advertisement_state_machine_stop(sm);	/*	 * Start out advertising down, this automatically switches	 * to advertising up which signals our restart.	 */	a->type = ADVERTISE_DOWN;	a->state = 0;	a->sm = sm;	/* (other fields not used here) */	/* First timeout should be random interval < 100 msec */	next_timeout_msec = (100 * (os_random() & 0xFF)) >> 8;	return eloop_register_timeout(0, next_timeout_msec,				      advertisement_state_machine_handler,				      NULL, sm);}/*************************************************************************** * M-SEARCH replies * These are very similar to the multicast advertisements, with some * small changes in data content; and they are sent (UDP) to a specific * unicast address instead of multicast. * They are sent in response to a UDP M-SEARCH packet. **************************************************************************/static void msearchreply_state_machine_handler(void *eloop_data,					       void *user_ctx);/** * msearchreply_state_machine_stop - Stop M-SEARCH reply state machine * @a: Selected advertisement/reply state */void msearchreply_state_machine_stop(struct advertisement_state_machine *a){	struct upnp_wps_device_sm *sm = a->sm;	wpa_printf(MSG_DEBUG, "WPS UPnP: M-SEARCH stop");	if (a->next == a) {		sm->msearch_replies = NULL;	} else {		if (sm->msearch_replies == a)			sm->msearch_replies = a->next;		a->next->prev = a->prev;		a->prev->next = a->next;	}	os_free(a);	sm->n_msearch_replies--;}static void msearchreply_state_machine_handler(void *eloop_data,					       void *user_ctx){	struct advertisement_state_machine *a = user_ctx;	struct upnp_wps_device_sm *sm = a->sm;	struct wpabuf *msg;	int next_timeout_msec = 100;	int next_timeout_sec = 0;	int islast = 0;	/*	 * Each response is sent twice (in case lost) w/ 100 msec delay	 * between; spec says no more than 3 times.	 * One pair for rootdevice, one pair for uuid, and a pair each for	 * each of the two urns.	 */	/* TODO: should only send the requested response types */	wpa_printf(MSG_MSGDUMP, "WPS UPnP: M-SEARCH reply state=%d (%s:%d)",		   a->state, inet_ntoa(a->client.sin_addr),		   ntohs(a->client.sin_port));	msg = next_advertisement(a, &islast);	if (msg == NULL)		return;	/*	 * Send it on the multicast socket to avoid having to set up another	 * socket.	 */	if (sendto(sm->multicast_sd, wpabuf_head(msg), wpabuf_len(msg), 0,		   (struct sockaddr *) &a->client, sizeof(a->client)) < 0) {		wpa_printf(MSG_DEBUG, "WPS UPnP: M-SEARCH reply sendto "			   "errno %d (%s) for %s:%d",			   errno, strerror(errno),			   inet_ntoa(a->client.sin_addr),			   ntohs(a->client.sin_port));		/* Ignore error and hope for the best */	}	wpabuf_free(msg);	if (islast) {		wpa_printf(MSG_DEBUG, "WPS UPnP: M-SEARCH reply done");		msearchreply_state_machine_stop(a);		return;	}	a->state++;	wpa_printf(MSG_MSGDUMP, "WPS UPnP: M-SEARCH reply in %d.%03d sec",		   next_timeout_sec, next_timeout_msec);	eloop_register_timeout(next_timeout_sec, next_timeout_msec,			       msearchreply_state_machine_handler, sm, a);}/** * msearchreply_state_machine_start - Reply to M-SEARCH discovery request * @sm: WPS UPnP state machine from upnp_wps_device_init() * @client: Client address * @mx: Maximum delay in seconds * * Use TTL of 4 (this was done when socket set up). * A response should be given in randomized portion of min(MX,120) seconds * * UPnP-arch-DeviceArchitecture, 1.2.3: * To be found, a device must send a UDP response to the source IP address and * port that sent the request to the multicast channel. Devices respond if the * ST header of the M-SEARCH request is "ssdp:all", "upnp:rootdevice", "uuid:" * followed by a UUID that exactly matches one advertised by the device. */static void msearchreply_state_machine_start(struct upnp_wps_device_sm *sm,					     struct sockaddr_in *client,					     int mx){	struct advertisement_state_machine *a;

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
本田岬高潮一区二区三区| 亚洲一区中文在线| 国产盗摄一区二区| 国产欧美一二三区| fc2成人免费人成在线观看播放| 国产精品网站在线播放| 色综合久久六月婷婷中文字幕| 亚洲乱码日产精品bd| 欧美日韩综合一区| 麻豆国产欧美一区二区三区| 国产欧美日韩三级| 欧美中文字幕一区| 精品亚洲porn| 亚洲视频综合在线| 欧美乱妇20p| 国产一区二区三区久久悠悠色av| 国产精品色在线| 欧美体内she精高潮| 麻豆91精品91久久久的内涵| 久久久99精品久久| 欧洲精品中文字幕| 一区二区三区日韩在线观看| 一本色道综合亚洲| 奇米亚洲午夜久久精品| 亚洲国产精品成人综合| 欧美中文字幕久久| 精品无人码麻豆乱码1区2区| 亚洲丝袜精品丝袜在线| 欧美成人精品3d动漫h| 91丨porny丨首页| 久久成人久久爱| 亚洲日本一区二区三区| 日韩欧美一区二区免费| av一区二区不卡| 九九**精品视频免费播放| 成人免费在线观看入口| 欧美大肚乱孕交hd孕妇| 91丨porny丨最新| 国产乱码精品一区二区三区五月婷| 亚洲男人的天堂在线aⅴ视频| 欧美大胆人体bbbb| 欧美日韩午夜在线| 成人免费不卡视频| 精品无码三级在线观看视频| 亚洲第一av色| ●精品国产综合乱码久久久久| 精品国产乱码久久久久久浪潮| 欧美日韩精品福利| 成人亚洲精品久久久久软件| 首页亚洲欧美制服丝腿| 国产精品女人毛片| 久久精品一区蜜桃臀影院| 欧美日韩高清一区| 日本精品视频一区二区| 成人h版在线观看| 国产电影一区二区三区| 青青草成人在线观看| 亚洲国产精品麻豆| 亚洲另类色综合网站| 国产精品三级av在线播放| www激情久久| 欧美大片拔萝卜| 日韩女优av电影| 欧美一区二区福利视频| 欧美日韩色一区| 色久优优欧美色久优优| 色婷婷久久久久swag精品| 成人国产精品免费观看| 不卡在线观看av| 国内成+人亚洲+欧美+综合在线| 日韩国产在线一| 午夜精品免费在线观看| 天天色 色综合| 亚洲国产视频a| 亚洲国产综合在线| 性做久久久久久免费观看欧美| 亚洲丰满少妇videoshd| 天使萌一区二区三区免费观看| 亚洲一区欧美一区| 五月婷婷另类国产| 视频一区二区国产| 久久电影网电视剧免费观看| 国产曰批免费观看久久久| 国产精品一区二区男女羞羞无遮挡| 久久99国内精品| 国产激情视频一区二区三区欧美 | 6080亚洲精品一区二区| 欧美日产在线观看| 日韩欧美不卡在线观看视频| 久久久综合九色合综国产精品| 久久久久久9999| 最新热久久免费视频| 亚洲影院理伦片| 午夜精品免费在线| 国产一区二区在线视频| 成年人网站91| 欧美日韩国产精选| 日韩精品一区二区三区中文不卡 | 国产午夜精品美女毛片视频| 国产欧美一区二区精品忘忧草| 中文字幕在线不卡一区二区三区| 亚洲精品ww久久久久久p站| 同产精品九九九| 国产在线国偷精品产拍免费yy | 亚洲第四色夜色| 久久er99精品| 不卡av在线网| 欧美男人的天堂一二区| 久久久久久**毛片大全| 一区二区三区在线观看视频| 奇米在线7777在线精品| www.欧美日韩| 69久久99精品久久久久婷婷| 国产视频在线观看一区二区三区| 亚洲精品ww久久久久久p站 | 日韩精品久久理论片| 国产乱码精品一区二区三| 日本久久精品电影| 久久这里只有精品6| 亚洲一区二区三区激情| 国产一区二区在线观看免费| 欧美性猛交xxxx黑人交| 久久精品综合网| 日韩国产高清影视| 91在线观看免费视频| 精品乱码亚洲一区二区不卡| 一区二区三区自拍| 国产精品99久久久久久久女警| 亚洲国产精品黑人久久久| 久久狠狠亚洲综合| 91日韩在线专区| 国产婷婷精品av在线| 日韩黄色免费电影| 色88888久久久久久影院按摩 | 精品免费国产一区二区三区四区| 中文字幕在线不卡| 国产精品主播直播| 91精品国产黑色紧身裤美女| 18成人在线观看| 国产成人免费视频一区| 日韩欧美亚洲另类制服综合在线 | 青青草原综合久久大伊人精品| 色综合天天综合给合国产| 久久精品亚洲一区二区三区浴池 | 亚瑟在线精品视频| 一本到一区二区三区| 欧美韩国日本不卡| 久久99精品国产麻豆婷婷| 在线91免费看| 亚欧色一区w666天堂| 欧美中文字幕亚洲一区二区va在线| 成人97人人超碰人人99| 亚洲国产视频一区二区| 成人高清在线视频| 精品粉嫩aⅴ一区二区三区四区 | 国产精品丝袜一区| 久久激五月天综合精品| 日韩欧美综合一区| 日本欧美大码aⅴ在线播放| 欧美三级电影网站| 午夜精品成人在线| 欧美午夜不卡视频| 亚瑟在线精品视频| 欧美欧美欧美欧美| 肉肉av福利一精品导航| 欧美一区二区三区爱爱| 蜜桃精品视频在线观看| 日韩一区二区三区免费观看| 男女男精品网站| 精品少妇一区二区三区在线视频| 激情五月激情综合网| ww久久中文字幕| 成人妖精视频yjsp地址| 日韩久久一区二区| 欧美一a一片一级一片| 性做久久久久久久免费看| 欧美一区二区私人影院日本| 免费在线看一区| 国产精品视频第一区| 日本aⅴ免费视频一区二区三区 | 麻豆精品视频在线| 欧美成人a∨高清免费观看| 国产精品白丝av| 专区另类欧美日韩| 在线免费不卡电影| 图片区日韩欧美亚洲| 日韩欧美美女一区二区三区| 国产iv一区二区三区| 亚洲欧美综合另类在线卡通| 精品污污网站免费看| 免费观看日韩av| 国产精品三级av| 欧美日韩美少妇| 国产精品18久久久久久久久久久久| 欧美激情综合五月色丁香小说| 一本大道久久a久久综合| 亚洲国产精品久久久男人的天堂| 欧美一级生活片| 国产 日韩 欧美大片| 亚洲无人区一区|