您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ tcp_init函数代码示例

51自学网 2021-06-03 08:42:15
  C++
这篇教程C++ tcp_init函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中tcp_init函数的典型用法代码示例。如果您正苦于以下问题:C++ tcp_init函数的具体用法?C++ tcp_init怎么用?C++ tcp_init使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了tcp_init函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: ssl_open

int ssl_open(http_t *client, char *msg){	char buf[256];	const char *sn;	X509 *cert;	if (!client->ssl_enabled)		return tcp_init(&client->tcp, msg);	tcp_set_port(&client->tcp, HTTPS_DEFAULT_PORT);	DO(tcp_init(&client->tcp, msg));	logit(LOG_INFO, "%s, initiating HTTPS ...", msg);	client->ssl_ctx = SSL_CTX_new(SSLv23_client_method());	if (!client->ssl_ctx)		return RC_HTTPS_OUT_OF_MEMORY;	/* POODLE, only allow TLSv1.x or later */	SSL_CTX_set_options(client->ssl_ctx, SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION);	SSL_CTX_set_verify(client->ssl_ctx, SSL_VERIFY_PEER, verify_callback);	SSL_CTX_set_verify_depth(client->ssl_ctx, 150);	/* Try to figure out location of trusted CA certs on system */	if (ssl_set_ca_location(client))		return RC_HTTPS_NO_TRUSTED_CA_STORE;	client->ssl = SSL_new(client->ssl_ctx);	if (!client->ssl)		return RC_HTTPS_OUT_OF_MEMORY;	/* SSL SNI support: tell the servername we want to speak to */	http_get_remote_name(client, &sn);	if (!SSL_set_tlsext_host_name(client->ssl, sn))		return RC_HTTPS_SNI_ERROR;	SSL_set_fd(client->ssl, client->tcp.ip.socket);	if (-1 == SSL_connect(client->ssl))		return RC_HTTPS_FAILED_CONNECT;	logit(LOG_INFO, "SSL connection using %s", SSL_get_cipher(client->ssl));	cert = SSL_get_peer_certificate(client->ssl);	if (!cert)		return RC_HTTPS_FAILED_GETTING_CERT;	if (SSL_get_verify_result(client->ssl) == X509_V_OK)		logit(LOG_DEBUG, "Certificate OK");	X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));	logit(LOG_INFO, "SSL server cert subject: %s", buf);	X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));	logit(LOG_INFO, "SSL server cert issuer: %s", buf);	X509_free(cert);	return 0;}
开发者ID:1100101,项目名称:inadyn,代码行数:58,


示例2: ssl_open

int ssl_open(http_t *client, char *msg){	char buf[256];	const char *sn;	const X509 *cert;	if (!client->ssl_enabled)		return tcp_init(&client->tcp, msg);	tcp_set_port(&client->tcp, 443);	DO(tcp_init(&client->tcp, msg));	logit(LOG_INFO, "%s, initiating HTTPS ...", msg);	client->ssl_ctx = SSL_CTX_new(SSLv23_client_method());	if (!client->ssl_ctx)		return RC_HTTPS_OUT_OF_MEMORY;	client->ssl = SSL_new(client->ssl_ctx);	if (!client->ssl)		return RC_HTTPS_OUT_OF_MEMORY;	/* SSL SNI support: tell the servername we want to speak to */	http_get_remote_name(client, &sn);	if (gnutls_server_name_set(client->ssl->gnutls_state, GNUTLS_NAME_DNS, sn, strlen(sn)))		return RC_HTTPS_SNI_ERROR;	SSL_set_fd(client->ssl, client->tcp.ip.socket);	if (-1 == SSL_connect(client->ssl))		return RC_HTTPS_FAILED_CONNECT;	logit(LOG_INFO, "SSL connection using %s", SSL_get_cipher(client->ssl));	/* Get server's certificate (note: beware of dynamic allocation) - opt */	cert = SSL_get_peer_certificate(client->ssl);	if (!cert)		return RC_HTTPS_FAILED_GETTING_CERT;	/* Logging some cert details. Please note: X509_NAME_oneline doesn't	   work when giving NULL instead of a buffer. */	X509_NAME_oneline(X509_get_subject_name(cert), buf, sizeof(buf));	logit(LOG_INFO, "SSL server cert subject: %s", buf);	X509_NAME_oneline(X509_get_issuer_name(cert), buf, sizeof(buf));	logit(LOG_INFO, "SSL server cert issuer: %s", buf);	/* We could do all sorts of certificate verification stuff here before	   deallocating the certificate. */	X509_free(cert);	return 0;}
开发者ID:ottaviane,项目名称:inadyn,代码行数:50,


示例3: microps_init

intmicrops_init (void) {    if (ethernet_init() == -1) {        goto ERROR;    }    if (slip_init() == -1) {        goto ERROR;    }    if (arp_init() == -1) {        goto ERROR;    }    if (ip_init() == -1) {        goto ERROR;    }    if (icmp_init() == -1) {        goto ERROR;    }    if (udp_init() == -1) {        goto ERROR;    }    if (tcp_init() == -1) {        goto ERROR;    }    return  0;ERROR:    microps_cleanup();    return -1;}
开发者ID:pandax381,项目名称:microps,代码行数:29,


示例4: ip_init

/* * IP initialization: fill in IP protocol switch table. * All protocols not implemented in kernel go to raw IP protocol handler. */voidip_init(Slirp *slirp){    slirp->ipq.ip_link.next = slirp->ipq.ip_link.prev = &slirp->ipq.ip_link;    udp_init(slirp);    tcp_init(slirp);}
开发者ID:aissat,项目名称:vde2,代码行数:11,


示例5: tcpipinit

void tcpipinit(){	prog_name= "kernel TCP/IP";	mu_init(&mu_generic);	mu_lock(&mu_generic);	tcpip_dirinit();	sr_init_cap_names();	sr_set_cap_name(ETH_DEV0, "eth");	sr_set_cap_name(IP_DEV0, "ip");	sr_set_cap_name(TCP_DEV0, "tcp");	sr_set_cap_name(UDP_DEV0, "udp");#if 0	sr_enable_linger_right();#endif	bf_init();	clck_init();	sr_init();	eth_init();	arp_init();	ip_init();	tcp_init();	udp_init();	add_default_gws();	mu_unlock(&mu_generic);	tcpip_chmod();}
开发者ID:yeonsh,项目名称:Amoeba,代码行数:31,


示例6: iso_send_connection_request

static BOOLiso_send_connection_request(RDPCLIENT * This, char *cookie){	STREAM s;	int cookielen = (int)strlen(cookie);	int length = 11 + cookielen;	s = tcp_init(This, length);	if(s == NULL)		return False;	out_uint8(s, 3);	/* version */	out_uint8(s, 0);	/* reserved */	out_uint16_be(s, length);	/* length */	out_uint8(s, length - 5);	/* hdrlen */	out_uint8(s, ISO_PDU_CR);	out_uint16(s, 0);	/* dst_ref */	out_uint16(s, 0);	/* src_ref */	out_uint8(s, 0);	/* class */	out_uint8p(s, cookie, cookielen);	s_mark_end(s);	return tcp_send(This, s);}
开发者ID:hoangduit,项目名称:reactos,代码行数:27,


示例7: tcpip_init

void tcpip_init(void){	net_mutex = thinkos_mutex_alloc();	assert(net_mutex > 0);	tcpip_net_lock();	DCC_LOG1(LOG_TRACE, "net_mutex=%d", net_mutex);	mbuf_init();	pktbuf_pool_init();#if (ENABLE_NET_RAW)	raw_init();#endif#if (ENABLE_NET_UDP)	udp_init();#endif#if (ENABLE_NET_TCP)	tcp_init();#endif	ifnet_init();	tcpip_net_unlock();}
开发者ID:bobmittmann,项目名称:thinkos,代码行数:30,


示例8: link_wait

int link_wait(link_t * ld, int service){  int   rc;   int   sdnew;   if (ld->fStdio) return 0;   rc = tcp_init(SF_ZOMBIES);   if (rc < 0) return (-1);   rc = tcp_socket(0);   if (rc < 0) return (-1);   ld->fd = rc;   rc = tcp_server(ld->fd, service, 8, NULL);   if (rc < 0) return (-1);   while(1)   {  do      {  sdnew = tcp_accept(ld->fd);      }  while(sdnew == (-1) && errno == EINTR);      if (sdnew < 0) break;      rc = tcp_forkclient(ld->fd, sdnew);      if (rc == 0)   // child      {  ld->fd = sdnew;         break;      }    }    return 0;}
开发者ID:semibiotic,项目名称:bee,代码行数:32,


示例9: microps_init

intmicrops_init (const struct microps_param *param) {    if (ethernet_init() == -1) {        goto ERROR;	}    if (ethernet_device_open(param->ethernet_device, param->ethernet_addr) == -1) {        goto ERROR;    }	if (arp_init() == -1) {        goto ERROR;    }    if (ip_init(param->ip_addr, param->ip_netmask, param->ip_gateway) == -1) {        goto ERROR;    }    if (icmp_init() == -1) {        goto ERROR;    }	if (udp_init() == -1) {        goto ERROR;    }	if (tcp_init() == -1) {        goto ERROR;    }    if (ethernet_device_run() == -1) {        goto ERROR;            }	return  0;ERROR:    //microps_cleanup();	return -1;}
开发者ID:f00Laz,项目名称:microps,代码行数:31,


示例10: iso_send_connection_request

static voidiso_send_connection_request(char *username){	STREAM s;	int length = 30 + strlen(username);	s = tcp_init(length);	out_uint8(s, 3);	/* version */	out_uint8(s, 0);	/* reserved */	out_uint16_be(s, length);	/* length */	out_uint8(s, length - 5);	/* hdrlen */	out_uint8(s, ISO_PDU_CR);	out_uint16(s, 0);	/* dst_ref */	out_uint16(s, 0);	/* src_ref */	out_uint8(s, 0);	/* class */	out_uint8p(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));	out_uint8p(s, username, strlen(username));	out_uint8(s, 0x0d);	/* Unknown */	out_uint8(s, 0x0a);	/* Unknown */	s_mark_end(s);	tcp_send(s);}
开发者ID:RPG-7,项目名称:reactos,代码行数:27,


示例11: main

int main(){	MSG message,snd_msg;	int read_n;	int reuse = 1;	signal(13,SIG_IGN);	int fd_server = tcp_init();	if( 0 != setsockopt(fd_server,SOL_SOCKET,SO_REUSEADDR,&reuse,sizeof(int)))	{		perror("set error/n");		exit(-1);	}	int fd_client;// = tcp_accpet(fd_server);		while( (fd_client = tcp_accept(fd_server)) )	{		memset(&message,0,sizeof(message));		recv(fd_client,&message,MSG_LEN,0);		recv(fd_client,&message.s_buf,message.s_len,0);		printf("recv msg:%s/n",message.s_buf);		int fd_file = open(message.s_buf,O_RDONLY);		while(memset(&snd_msg,0,sizeof(snd_msg)),(read_n = read(fd_file,snd_msg.s_buf,MSG_SIZE))>0 )		{			snd_msg.s_len = read_n;			send(fd_client,&snd_msg,snd_msg.s_len+MSG_LEN,0);		}		snd_msg.s_len = 0;		send(fd_client,&snd_msg,snd_msg.s_len+MSG_LEN,0);		close(fd_file);		close(fd_client);	}}
开发者ID:Andrew-liu,项目名称:learn_cplusplus,代码行数:35,


示例12: iso_fp_init

/* Initialize fast path data packet */STREAMiso_fp_init(rdpIso * iso, int length){	STREAM s;	s = tcp_init(iso->tcp, length + 3);	s_push_layer(s, iso_hdr, 3);	return s;}
开发者ID:g-reno,项目名称:FreeRDP-old,代码行数:9,


示例13: ip_init

/* * IP initialization: fill in IP protocol switch table. * All protocols not implemented in kernel go to raw IP protocol handler. */voidip_init(){	ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;	ip_id = tt.tv_sec & 0xffff;	udp_init();	tcp_init();}
开发者ID:agocke,项目名称:qemu,代码行数:12,


示例14: ip_init

/* * IP initialization: fill in IP protocol switch table. * All protocols not implemented in kernel go to raw IP protocol handler. */void ip_init(void){	ipq.next = ipq.prev = (ipqp_32)&ipq;	ip_id = tt.tv_sec & 0xffff;	udp_init();	tcp_init();	ip_defttl = IPDEFTTL;}
开发者ID:sunfirefox,项目名称:WinUAE,代码行数:12,


示例15: lwip_init

/** * Perform Sanity check of user-configurable values, and initialize all modules. */voidlwip_init(void){  /* Sanity check user-configurable values */  lwip_sanity_check();  /* Modules initialization */  stats_init();#if !NO_SYS  sys_init();#endif /* !NO_SYS */  mem_init();  memp_init();  pbuf_init();  netif_init();#if LWIP_SOCKET  lwip_socket_init();#endif /* LWIP_SOCKET */  ip_init();#if LWIP_ARP  etharp_init();#endif /* LWIP_ARP */#if LWIP_RAW  raw_init();#endif /* LWIP_RAW */#if LWIP_UDP  udp_init();#endif /* LWIP_UDP */#if LWIP_TCP  tcp_init();#endif /* LWIP_TCP */#if LWIP_SNMP  snmp_init();#endif /* LWIP_SNMP */#if LWIP_AUTOIP  autoip_init();#endif /* LWIP_AUTOIP */#if LWIP_IGMP  igmp_init();#endif /* LWIP_IGMP */#if LWIP_DNS  dns_init();#endif /* LWIP_DNS */#if LWIP_TIMERS  sys_timeouts_init();#endif /* LWIP_TIMERS */#if !NO_SYS  /* in the Xilinx lwIP 1.2.0 port, lwip_init() was added as a convenience utility function     to initialize all the lwIP layers. lwIP 1.3.0 introduced lwip_init() in the base lwIP     itself. However a user cannot use lwip_init() regardless of whether it is raw or socket     modes. The following call to lwip_sock_init() is made to make sure that lwIP is properly     initialized in both raw & socket modes with just a call to lwip_init().   */  lwip_sock_init();#endif}
开发者ID:GiannisRambo,项目名称:lwip,代码行数:61,


示例16: main

int main(int argc, char *argv[]) {	// listen on TCP port SSP_SERVER_PORT	tcp_init();	while ( !app_done ) {		if ( udp_enabled ) udp_send();		tcp_read_cmd( udp_enabled );	}	return 0;}
开发者ID:nthallen,项目名称:arp-fpga,代码行数:9,


示例17: ip_init

/* * IP initialization: fill in IP protocol switch table. * All protocols not implemented in kernel go to raw IP protocol handler. */voidip_init(){	ipq.ip_link.next = ipq.ip_link.prev = &ipq.ip_link;	ip_id = tt.tv_sec & 0xffff;	udp_init();	tcp_init();	ip_defttl = IPDEFTTL;}
开发者ID:zydeco,项目名称:macemu,代码行数:13,


示例18: lwip_init

/** * Perform Sanity check of user-configurable values, and initialize all modules. */voidlwip_init(void){  /*++ Changed by Espressif ++*/  MEMP_NUM_TCP_PCB = 5;  TCP_WND = (4 * TCP_MSS);  TCP_MAXRTX = 3;  TCP_SYNMAXRTX = 6;  /*--                      --*/  /* Modules initialization */  stats_init();#if !NO_SYS  sys_init();#endif /* !NO_SYS *//*++ Changed by Espressif ++*/#if 0  mem_init(&_bss_end);#endif/*--                      --*/  memp_init();  pbuf_init();  netif_init();#if LWIP_SOCKET  lwip_socket_init();#endif /* LWIP_SOCKET */  ip_init();#if LWIP_ARP  etharp_init();#endif /* LWIP_ARP */#if LWIP_RAW  raw_init();#endif /* LWIP_RAW */#if LWIP_UDP  udp_init();#endif /* LWIP_UDP */#if LWIP_TCP  tcp_init();#endif /* LWIP_TCP */#if LWIP_SNMP  snmp_init();#endif /* LWIP_SNMP */#if LWIP_AUTOIP  autoip_init();#endif /* LWIP_AUTOIP */#if LWIP_IGMP  igmp_init();#endif /* LWIP_IGMP */#if LWIP_DNS  dns_init();#endif /* LWIP_DNS */#if LWIP_TIMERS  sys_timeouts_init();#endif /* LWIP_TIMERS */}
开发者ID:sdelavega,项目名称:smart.js,代码行数:60,


示例19: x224_send_connection_request

/* Output and send X.224 Connection Request TPDU with routing for username */voidx224_send_connection_request(rdpIso * iso){	STREAM s;	int length = 11;	int cookie_length;	cookie_length = strlen(iso->cookie);	if (iso->mcs->sec->rdp->redirect_routingtoken)		/* routingToken */		length += iso->mcs->sec->rdp->redirect_routingtoken_len;	else		/* cookie */		length += 19 + cookie_length;	if (iso->nego->requested_protocols > PROTOCOL_RDP)		length += 8;	/* FIXME: Use x224_send_dst_src_class */	s = tcp_init(iso->tcp, length);	tpkt_output_header(s, length);	/* X.224 Connection Request (CR) TPDU */	out_uint8(s, length - 5);	/* length indicator */	out_uint8(s, X224_TPDU_CONNECTION_REQUEST);	out_uint16_le(s, 0);	/* dst_ref */	out_uint16_le(s, 0);	/* src_ref */	out_uint8(s, 0);	/* class */	if (iso->mcs->sec->rdp->redirect_routingtoken)	{		/* routingToken */		out_uint8p(s, iso->mcs->sec->rdp->redirect_routingtoken, iso->mcs->sec->rdp->redirect_routingtoken_len);	}	else	{		/* cookie */		out_uint8p(s, "Cookie: mstshash=", strlen("Cookie: mstshash="));		out_uint8p(s, iso->cookie, cookie_length);		out_uint8(s, 0x0D);	/* CR */		out_uint8(s, 0x0A);	/* LF */	}	if (iso->nego->requested_protocols > PROTOCOL_RDP)	{		out_uint8(s, TYPE_RDP_NEG_REQ); /* When using TLS, NLA, or both, RDP_NEG_DATA should be present */		out_uint8(s, 0x00);	/* flags, must be set to zero */		out_uint16_le(s, 8);	/* RDP_NEG_DATA length (8) */		out_uint32_le(s, iso->nego->requested_protocols); /* requestedProtocols */	}	s_mark_end(s);	tcp_send(iso->tcp, s);}
开发者ID:g-reno,项目名称:FreeRDP-old,代码行数:57,


示例20: main

int main(int argc, char **argv){	struct sigaction sig_stop;	struct sigaction sig_time;	_main = main_init(argc, argv);	_log = log_init();	_main->conf = conf_init(argc, argv);	_main->work = work_init();	_main->tcp = tcp_init();	_main->node = node_init();	_main->mime = mime_init();	/* Check configuration */	conf_print();	/* Catch SIG INT */	unix_signal(&sig_stop, &sig_time);	/* Fork daemon */	unix_fork(log_console(_log));	/* Increase limits */	unix_limits(_main->conf->cores, CONF_EPOLL_MAX_EVENTS);	/* Load mime types */	mime_load();	mime_hash();	/* Prepare TCP daemon */	tcp_start();	/* Drop privileges */	unix_dropuid0();	/* Start worker threads */	work_start();	/* Stop worker threads */	work_stop();	/* Stop TCP daemon */	tcp_stop();	mime_free();	node_free();	tcp_free();	work_free();	conf_free();	log_free(_log);	main_free();	return 0;}
开发者ID:tempbottle,项目名称:torrentkino,代码行数:56,


示例21: iso_init

/* Initialise ISO transport data packet */STREAMiso_init(int length){	STREAM s;	s = tcp_init(length + 7);	s_push_layer(s, iso_hdr, 7);	return s;}
开发者ID:RPG-7,项目名称:reactos,代码行数:11,


示例22: main_thread

static voidmain_thread(void *arg){    tcp_init();    while(1)    {        tcp_input    }}
开发者ID:1573472562,项目名称:netfpga,代码行数:10,


示例23: lwip_init

/** * Perform Sanity check of user-configurable values, and initialize all modules. */voidlwip_init(void){  esp_ms_timer_init(); // espressif  /* Modules initialization */  stats_init();#if !NO_SYS  sys_init();#endif /* !NO_SYS */  mem_init();  memp_init();  pbuf_init();  netif_init();#if LWIP_IPV4  ip_init();#if LWIP_ARP  etharp_init();#endif /* LWIP_ARP */#endif /* LWIP_IPV4 */#if LWIP_RAW  raw_init();#endif /* LWIP_RAW */#if LWIP_UDP  udp_init();#endif /* LWIP_UDP */#if LWIP_TCP  tcp_init();#endif /* LWIP_TCP */#if LWIP_SNMP  snmp_init();#endif /* LWIP_SNMP */#if LWIP_AUTOIP  autoip_init();#endif /* LWIP_AUTOIP */#if LWIP_IGMP  igmp_init();#endif /* LWIP_IGMP */#if LWIP_DNS  dns_init();#endif /* LWIP_DNS */#if LWIP_IPV6  ip6_init();  nd6_init();#if LWIP_IPV6_MLD  mld6_init();#endif /* LWIP_IPV6_MLD */#endif /* LWIP_IPV6 */#if PPP_SUPPORT  ppp_init();#endif#if LWIP_TIMERS  sys_timeouts_init();#endif /* LWIP_TIMERS */}
开发者ID:alemoke,项目名称:esp8266-frankenstein,代码行数:58,


示例24: network_init

void network_init(){	struct ip_addr ipaddr, netmask, gw;	printf("trying to initialize network.../n");#ifdef STATS	stats_init();#endif /* STATS */	mem_init();	memp_init();	pbuf_init(); 	netif_init();	ip_init();	udp_init();	tcp_init();	etharp_init();	printf("ok now the NIC/n");		if (!netif_add(&netif, &ipaddr, &netmask, &gw, NULL, enet_init, ip_input))	{		printf("netif_add failed!/n");		return;	}		netif_set_default(&netif);		dhcp_start(&netif);		mftb(&last_tcp);	mftb(&last_dhcp);		printf("/nWaiting for DHCP");	int i;		for (i=0; i<10; i++) {		mdelay(500);		network_poll();				printf(".");				if (netif.ip_addr.addr)			break;	}		if (netif.ip_addr.addr) {		printf("%u.%u.%u.%u/n",				(netif.ip_addr.addr >> 24) & 0xFF,			(netif.ip_addr.addr >> 16) & 0xFF,			(netif.ip_addr.addr >>  8) & 0xFF,			(netif.ip_addr.addr >>  0) & 0xFF);					printf("/n");	} else {
开发者ID:CJP1973,项目名称:xell,代码行数:55,


示例25: tcpip_thread

static voidtcpip_thread(void *arg){  struct tcpip_msg *msg;  (void)arg;  ip_init();#if LWIP_UDP    udp_init();#endif#if LWIP_TCP  tcp_init();#endif#if IP_REASSEMBLY  sys_timeout(1000, ip_timer, NULL);#endif  if (tcpip_init_done != NULL) {    tcpip_init_done(tcpip_init_done_arg);  }  while (1) {                          /* MAIN Loop */    sys_mbox_fetch(mbox, (void *)&msg);    switch (msg->type) {    case TCPIP_MSG_API:      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p/n", (void *)msg));      api_msg_input(msg->msg.apimsg);      break;    case TCPIP_MSG_INPUT:      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p/n", (void *)msg));      ip_input(msg->msg.inp.p, msg->msg.inp.netif);      break;    case TCPIP_MSG_CALLBACK:      LWIP_DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p/n", (void *)msg));      msg->msg.cb.f(msg->msg.cb.ctx);      break;    default:      break;    }#ifdef VBOX    if (msg->type == TCPIP_MSG_TERM)    {        memp_free(MEMP_TCPIP_MSG, msg);        break;    }#endif    memp_free(MEMP_TCPIP_MSG, msg);  }#ifdef VBOX  if (tcpip_init_done != NULL) {    tcpip_init_done(tcpip_init_done_arg);  }#endif}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:54,


示例26: nptcp_init

intnptcp_init(){   int   i;   /* total netport buffers:    * Get twice the number of packet buffers plus 3, to help    * support UDP. if you are receiving UDP packets faster    * than your UDP server can process them, its possible for     * all of your packet buffers to end up in the UDP socket's     * receive queue. each of these packet buffers has associated with     * it 2 mbufs, one for the packet buffer itself and one for the     * address of the remote host that the packet came from. in order     * for this socket queue to get emptied and the receive buffers to     * get freed, the socket has to be read and what's the first thing     * that soreceive() does to try to do this? it tries to allocate     * an mbuf, so if you only have twice as many mbufs as packet     * buffers, soreceive() can't complete and the packet buffers stay     * on the queue, so we allocate 3 extra mbufs in the hope that     * this will allow soreceive() to complete and free up the packet     * buffers. yes, its kind of an ugly hack and 3 is a wild guess.    */   unsigned bufcount = (lilbufs + bigbufs) * 2 + 3;   struct mbuf *  m; /* scratch mbuf for mfreeq init */   MEMSET(&soq, 0, sizeof(soq));    /* Set socket queue to NULLs */   MEMSET(&mbufq, 0, sizeof(mbufq));   MEMSET(&mfreeq, 0, sizeof(mfreeq));   for (i = 0; i < (int)bufcount; i++)   {      m = MBU_ALLOC(sizeof(struct mbuf));      if (!m)  /* malloc error, bail out */         panic("tcpinit");      m->m_type = MT_FREE;      m->m_len = 0;      m->m_data = NULL;      putq(&mfreeq, (qp)m);   }   mfreeq.q_min = (int)bufcount;   /* this should match q_max and q_len */#ifdef INCLUDE_SNMP                /* SNMP initialization */   tcpmib.tcpRtoAlgorithm = 4;     /* Van Jacobson's algorithm */   tcpmib.tcpRtoMin = TCPTV_MIN * 1000;      /* PR_SLOWHZ */   tcpmib.tcpRtoMax = TCPTV_REXMTMAX * 1000; /* PR_SLOWHZ */#endif   tcp_init();    /* call the BSD init in tcp_usr.c */#ifdef TCP_MENUS   install_menu(&tcpmenu[0]);#endif   /* IN_MENUS */   return 0;   /* good return */}
开发者ID:ECE492W2014G4,项目名称:G4Capstone,代码行数:53,


示例27: main

int main(int argc, char **argv){  char msg[2048] = {0};  stream_t req, res;  struct tcp_t *tcp;  const char * address = "www.google.com";  const char * port = "80";  if (argv[1])    address = argv[1];  if (argv[2])    port = argv[2];  sprintf(msg, "GET / HTTP/1.1/nHost: %s/n/n", address);  /* allocate and setup io streams*/  stream_init(&req, 4096);  stream_init(&res, 4096);  stream_out_uint8p(&req, msg, strlen(msg));  stream_mark_end(&req);  /* initialize tcp */  tcp_init();  /* setup tcp and connect*/  tcp = tcp_new();  tcp_set_property(tcp, TCP_PROP_ADDRESS, address);  tcp_set_property(tcp, TCP_PROP_PORT, port);#ifdef WITH_GNUTLS  tcp_set_property(tcp, TCP_PROP_USE_TLS, atoi(port) == 443 ? "1" : "0");#endif  tcp_connect(tcp);  /* write http request and recv response */  tcp_send(tcp, &req);  tcp_recv(tcp, &res, 4096);  fprintf(stdout,"%s", res.data);  tcp_disconnect(tcp);  tcp_destroy(tcp);  tcp_deinit();  return 0;}
开发者ID:majestrate,项目名称:i2p-tools,代码行数:52,


示例28: lwip_init

/** * Perform Sanity check of user-configurable values, and initialize all modules. */void ICACHE_FLASH_ATTRlwip_init(void){    /* Modules initialization */    stats_init();#if !NO_SYS    sys_init();#endif /* !NO_SYS */    mem_init();    memp_init();    pbuf_init();    netif_init();#if LWIP_SOCKET    lwip_socket_init();#endif /* LWIP_SOCKET */    ip_init();#if LWIP_ARP    etharp_init();#endif /* LWIP_ARP */#if LWIP_RAW    raw_init();#endif /* LWIP_RAW */#if LWIP_UDP    udp_init();#endif /* LWIP_UDP */#if LWIP_TCP    tcp_init();#endif /* LWIP_TCP */#if LWIP_SNMP    snmp_init();#endif /* LWIP_SNMP */#if LWIP_AUTOIP    autoip_init();#endif /* LWIP_AUTOIP */#if LWIP_IGMP    igmp_init();#endif /* LWIP_IGMP */#if LWIP_DNS    dns_init();#endif /* LWIP_DNS */#if LWIP_IPV6    ip6_init();    nd6_init();#if LWIP_IPV6_MLD    mld6_init();#endif /* LWIP_IPV6_MLD */#endif /* LWIP_IPV6 */#if LWIP_TIMERS    sys_timeouts_init();#endif /* LWIP_TIMERS */}
开发者ID:houzhenggang,项目名称:esp8266-rtos-sdk,代码行数:55,


示例29: lwip_raw_init

voidlwip_raw_init(){	ip_init();	/* Doesn't do much, it should be called to handle future changes. */#if LWIP_UDP	udp_init();	/* Clears the UDP PCB list. */#endif#if LWIP_TCP	tcp_init();	/* Clears the TCP PCB list and clears some internal TCP timers. */			/* Note: you must call tcp_fasttmr() and tcp_slowtmr() at the */			/* predefined regular intervals after this initialization. */#endif}
开发者ID:AlexShiLucky,项目名称:freertos,代码行数:13,


示例30: ip_init

/* * IP initialization: fill in IP protocol switch table. * All protocols not implemented in kernel go to raw IP protocol handler. */voidip_init(PNATState pData){    int i = 0;    for (i = 0; i < IPREASS_NHASH; ++i)        TAILQ_INIT(&ipq[i]);    maxnipq = 100; /* ??? */    maxfragsperpacket = 16;    nipq = 0;    ip_currid = tt.tv_sec & 0xffff;    udp_init(pData);    tcp_init(pData);}
开发者ID:MadHacker217,项目名称:VirtualBox-OSE,代码行数:17,



注:本文中的tcp_init函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ tcp_new函数代码示例
C++ tcp_hdr函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。