这篇教程C++ uip_aborted函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中uip_aborted函数的典型用法代码示例。如果您正苦于以下问题:C++ uip_aborted函数的具体用法?C++ uip_aborted怎么用?C++ uip_aborted使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了uip_aborted函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(example_psock_client_process, ev, data){ uip_ipaddr_t addr; printf("%d/n", TEST); PROCESS_BEGIN(); uip_ipaddr(addr, 192,168,2,1); tcp_connect(addr, UIP_HTONS(80), NULL); printf("Connecting.../n"); PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if(uip_aborted() || uip_timedout() || uip_closed()) { printf("Could not establish connection/n"); } else if(uip_connected()) { printf("Connected/n"); PSOCK_INIT(&ps, buffer, sizeof(buffer)); do { handle_connection(&ps); PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); } while(!(uip_closed() || uip_aborted() || uip_timedout())); printf("/nConnection closed./n"); } PROCESS_END();}
开发者ID:1uk3,项目名称:contiki,代码行数:31,
示例2: PROCESS_THREADPROCESS_THREAD(server_process, ev, data){ PROCESS_BEGIN(); set_global_address(); leds_init(); print_local_addresses(); printf("Starting TCP server on port=%d/n", PORT); tcp_listen(UIP_HTONS(PORT)); while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if(uip_aborted() ) printf("TCP aborted/n"); if(uip_timedout() ) printf("TCP timeoutn/n"); if(uip_closed() ) printf("TCP closed/n"); if(uip_connected()) { printf("TCP Connected/n/r"); PSOCK_INIT(&ps, buf, sizeof(buf)); while(!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); handle_connection(&ps); } } } PROCESS_END();}
开发者ID:1847123212,项目名称:contiki,代码行数:32,
示例3: PROCESS_THREAD/*---------------------------------------------------------------------------*/PROCESS_THREAD(server_process, ev, data){ PROCESS_BEGIN(); u16_t hostport = 7777; printf("TCP listen on %d.%d.%d.%d:%u/n", uip_ipaddr_to_quad(&uip_hostaddr), hostport); tcp_listen(uip_htons(hostport)); while(1) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); if (uip_connected()) { printf("server: client arrived!/n"); connected = 1; while (!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); } if (uip_aborted() || uip_closed()) { connected = 0; } } else { printf("server: client not accepted!/n"); KLEENET_ASSERT(0 && "server: client not accepted!/n"); } } PROCESS_END();}
开发者ID:kincki,项目名称:contiki,代码行数:31,
示例4: ctk_vncserver_appcall/*-----------------------------------------------------------------------------------*/voidctk_vncserver_appcall(void *state){ static struct vnc_server_state *vs; vs = (struct vnc_server_state *)(state); if(uip_connected()) { /* Since we've just been connected, the state pointer should be NULL and we need to allocate a new state object. If we have run out of memory for state objects, we'll have to abort the connection and return. */ if(vs == NULL) { vs = alloc_state(); if(vs == NULL) { uip_close(); return; } tcp_markconn(uip_conn, (void *)vs); } } else if(uip_closed() || uip_aborted()) { if(vs != NULL) { dealloc_state(vs); } return; } vnc_server_appcall(vs);}
开发者ID:Asterios,项目名称:contiki-econotag,代码行数:30,
示例5: tcp_server_demo_appcall//这是一个TCP 服务器应用回调函数。//该函数通过UIP_APPCALL(tcp_demo_appcall)调用,实现Web Server的功能.//当uip事件发生时,UIP_APPCALL函数会被调用,根据所属端口(1200),确定是否执行该函数。//例如 : 当一个TCP连接被创建时、有新的数据到达、数据已经被应答、数据需要重发等事件void tcp_server_demo_appcall(void){ struct tcp_demo_appstate *s = (struct tcp_demo_appstate *)&uip_conn->appstate; if(uip_aborted())tcp_server_aborted(); //连接终止 if(uip_timedout())tcp_server_timedout(); //连接超时 if(uip_closed())tcp_server_closed(); //连接关闭 if(uip_connected())tcp_server_connected(); //连接成功 if(uip_acked())tcp_server_acked(); //发送的数据成功送达 //接收到一个新的TCP数据包 if (uip_newdata())//收到客户端发过来的数据 { if((tcp_server_sta&(1<<6))==0)//还未收到数据 { if(uip_len>199) { ((uint8_t*)uip_appdata)[199]=0; } strcpy((char*)tcp_server_databuf,uip_appdata); tcp_server_sta|=1<<6;//表示收到客户端数据 } }else if(tcp_server_sta&(1<<5))//有数据需要发送 { s->textptr=tcp_server_databuf; s->textlen=strlen((const char*)tcp_server_databuf); tcp_server_sta&=~(1<<5);//清除标记 } //当需要重发、新数据到达、数据包送达、连接建立时,通知uip发送数据 if(uip_rexmit()||uip_newdata()||uip_acked()||uip_connected()||uip_poll()) { tcp_server_senddata(); }}
开发者ID:RdMaxes,项目名称:stm32f103_uIP_ENC28J60,代码行数:36,
示例6: uip_task_appcallvoid uip_task_appcall(){ if(uip_connected()) { socket_process_new_connect_(); }else if(uip_poll()) { if(uip_stopped(uip_conn)) { socket_process_try_restart_(); } socket_process_write_(); }else if(uip_newdata()) { socket_process_new_data_(); socket_process_write_(); }else if(uip_aborted() || uip_closed()) { socket_process_close_(); }else if(uip_timedout()) { socket_process_timeout_(); uip_close(); }else if(uip_acked() || uip_rexmit()) { socket_process_write_(); }}
开发者ID:jayaraj-poroor,项目名称:freertos-uip-kernel,代码行数:34,
示例7: PROCESS_THREADPROCESS_THREAD(tcp_process, ev, data){ static char incoming[10]; static struct psock ps; PROCESS_BEGIN(); uart0_set_br(1000000); tcp_listen(UIP_HTONS(2020)); while(1) { PROCESS_YIELD(); } { /* wait for tcp connection */ PROCESS_WAIT_EVENT_UNTIL(ev==tcpip_event && uip_connected()); /* start estimator process and init psock connection handler */ process_start(&ahrs_process, NULL); PSOCK_INIT(&ps,incoming,sizeof(incoming)); /* loop until connection is closed */ while (!(uip_aborted() || uip_closed() || uip_timedout())) { PROCESS_YIELD_UNTIL(ev==tcpip_event); handle_connection(&ps); } /* stop ahrs process */ process_exit(&ahrs_process); } PROCESS_END();}
开发者ID:cloud-hot,项目名称:Jennisense,代码行数:35,
示例8: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void *state){ struct httpd_state *s = (struct httpd_state *)state; if(uip_closed() || uip_aborted() || uip_timedout()) { if(s != NULL) { memb_free(&conns, s); } } else if(uip_connected()) { s = (struct httpd_state *)memb_alloc(&conns); if(s == NULL) { uip_abort(); return; } tcp_markconn(uip_conn, s); PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; timer_set(&s->timer, CLOCK_SECOND * 10); handle_connection(s); } else if(s != NULL) { if(uip_poll()) { if(timer_expired(&s->timer)) { uip_abort(); } } else { timer_reset(&s->timer); } handle_connection(s); } else { uip_abort(); }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:36,
示例9: telnetd_appcall/*---------------------------------------------------------------------------*/voidtelnetd_appcall(void *ts){ if(uip_connected()) { tcp_markconn(uip_conn, &s); buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; shell_start(); } if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { closed(); } if(uip_acked()) { acked(); } if(uip_newdata()) { newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:36,
示例10: uipcall/*---------------------------------------------------------------------*/static voiduipcall(void *state){ if(uip_udpconnection()) { recv_udpthread(&s.recv_udpthread_pt); send_udpthread(&s.udpthread_pt); } else { if(uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) { if(uip_connected()) { if(state == NULL) { s.addr = 0; s.count = 0; PT_INIT(&s.tcpthread_pt); process_poll(&codeprop_process); tcp_markconn(uip_conn, &s);/* process_post(PROCESS_BROADCAST, codeprop_event_quit, *//* (process_data_t)NULL); */ } else { PRINTF(("codeprop: uip_connected() and state != NULL/n")); uip_abort(); } } recv_tcpthread(&s.tcpthread_pt); if(uip_closed() || uip_aborted() || uip_timedout()) { PRINTF(("codeprop: connection down/n")); tcp_markconn(uip_conn, NULL); } } }}
开发者ID:EDAyele,项目名称:ptunes,代码行数:34,
示例11: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void){ struct httpd_state *s = (struct httpd_state *)&(uip_conn->appstate); if(uip_closed() || uip_aborted() || uip_timedout()) { } else if(uip_connected()) { PSOCK_INIT(&s->sin, s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ s->timer = 0; handle_connection(s); } else if(s != NULL) { if(uip_poll()) { ++s->timer; if(s->timer >= 20) { uip_abort(); } } else { s->timer = 0; } handle_connection(s); } else { uip_abort(); }}
开发者ID:topiaruss,项目名称:xmostcptests,代码行数:29,
示例12: PROCESS_THREAD/*---------------------------------------------------------------------*/PROCESS_THREAD(tcp_loader_process, ev, data){ PROCESS_BEGIN(); tcp_listen(HTONS(CODEPROP_DATA_PORT)); while(1) { PROCESS_YIELD(); if(ev == tcpip_event && uip_conn->lport == HTONS(CODEPROP_DATA_PORT)) { if(uip_connected()) { /* Really uip_connecting()!!! */ if(data == NULL) { PT_INIT(&s.tcpthread_pt); process_poll(&tcp_loader_process); tcp_markconn(uip_conn, &s); } else { PRINTF(("codeprop: uip_connected() and data != NULL/n")); uip_abort(); } } recv_tcpthread(&s.tcpthread_pt); /* Run thread */ if(uip_closed() || uip_aborted() || uip_timedout()) { PRINTF(("codeprop: connection down/n")); tcp_markconn(uip_conn, NULL); } } } PROCESS_END();}
开发者ID:EDAyele,项目名称:ptunes,代码行数:31,
示例13: PROCESS_THREAD/* -------------------------------------------------------------------------- */PROCESS_THREAD(example_psock_server_process, ev, data){ // The Start... PROCESS_BEGIN(); // So, here we configure the network listening at a TCP port. tcp_listen(UIP_HTONS(12345)); while (1) { // Wait a TCP / IP event... PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); // If someone has connected, let's init the connection if (uip_connected()) { // Bind the buffer to the socket PSOCK_INIT(&socket, buffer, sizeof(buffer)); // So now, let's keep the connection open waiting for something while (!(uip_aborted() || uip_closed() || uip_timedout())) { // Wait for an TCIP / IP event PROCESS_WAIT_EVENT_UNTIL(ev == tcpip_event); // And then, let's send to handle the data handle_connection(&socket); } } } // ... the End PROCESS_END();}
开发者ID:RauPerez25,项目名称:Wall-E,代码行数:32,
示例14: contiki_appcallstatic void contiki_appcall(void *data){ contiki_data_t *s = (contiki_data_t *)data; if (uip_closed() || uip_aborted() || uip_timedout()) { //xprintf("closed or aborted or timedout/n"); if (s->state == READING || s->state == WRITTING) { s->state = ERROR; } else { s->state = CLOSED; } process_post_synch(s->process, xively_event, s); } else if (uip_connected()) { s->state = CONNECTED; PSOCK_INIT(&s->p, NULL, 0); process_post_synch(s->process, xively_event, s); } else if (uip_newdata()) { if (s->state == READING) { s->state = READ_END; process_post_synch(s->process, xively_event, s); } } if (s->state == CLOSING) { uip_close(); } handle_output(s);}
开发者ID:foss-for-synopsys-dwc-arc-processors,项目名称:libxively,代码行数:27,
示例15: irc_mainstatic voidirc_main(void){ if (uip_aborted() || uip_timedout()) { IRCDEBUG ("connection aborted/n"); irc_conn = NULL; } if (uip_closed()) { IRCDEBUG ("connection closed/n"); irc_conn = NULL; } if (uip_connected()) { IRCDEBUG ("new connection/n"); STATE->stage = IRC_SEND_USERNICK; STATE->sent = IRC_SEND_INIT;#ifdef ECMD_IRC_SUPPORT STATE->reparse = 0;#endif *STATE->outbuf = 0; } if (STATE->stage == IRC_SEND_JOIN && uip_acked ()) STATE->stage ++; else if (STATE->stage == IRC_CONNECTED && uip_acked ()) { *STATE->outbuf = 0;#ifdef ECMD_IRC_SUPPORT if (STATE->reparse) irc_handle_ecmd ();#endif } else if (uip_newdata() && uip_len) { ((char *) uip_appdata)[uip_len] = 0; IRCDEBUG ("received data: %s/n", uip_appdata); if (irc_parse ()) { uip_close (); /* Parse error */ return; } } if (uip_rexmit ()) irc_send_data (STATE->sent); else if ((STATE->stage > STATE->sent || STATE->stage == IRC_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) irc_send_data (STATE->stage); else if (STATE->stage == IRC_CONNECTED && uip_poll() && *STATE->outbuf) irc_send_data (STATE->stage);}
开发者ID:HansBaechle,项目名称:ethersex,代码行数:59,
示例16: webclient_appcall/*-----------------------------------------------------------------------------------*/voidwebclient_appcall(void){ if(uip_connected()) { s.timer = 0; s.state = WEBCLIENT_STATE_STATUSLINE; senddata(); webclient_connected(); return; } if(s.state == WEBCLIENT_STATE_CLOSE) { webclient_closed(); uip_abort(); return; } if(uip_aborted()) { webclient_aborted(); } if(uip_timedout()) { webclient_timedout(); } if(uip_acked()) { s.timer = 0; acked(); } if(uip_newdata()) { s.timer = 0; newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { ++s.timer; if(s.timer == WEBCLIENT_TIMEOUT) { webclient_timedout(); uip_abort(); return; } /* senddata();*/ } if(uip_closed()) { if(s.httpflag != HTTPFLAG_MOVED) { /* Send NULL data to signal EOF. */ webclient_datahandler(NULL, 0); } else { if(resolv_lookup(s.host) == NULL) { resolv_query(s.host); } webclient_get(s.host, s.port, s.file); } }}
开发者ID:ichpuchtli,项目名称:freeburn,代码行数:60,
示例17: httpd_mainvoidhttpd_main(void){ if (uip_aborted() || uip_timedout()) { printf("httpd: connection aborted/n"); httpd_cleanup(); return; } if (uip_closed()) { printf("httpd: connection closed/n"); httpd_cleanup(); return; } if (uip_connected()) { printf("httpd: new connection/n"); /* initialize struct */ STATE->handler = NULL; STATE->header_acked = 0; STATE->eof = 0; STATE->header_reparse = 0;#ifdef HTTPD_AUTH_SUPPORT STATE->auth_state = PAM_UNKOWN;#endif } if (uip_newdata() && (!STATE->handler || STATE->header_reparse)) { printf("httpd: new data/n"); httpd_handle_input(); }#ifdef HTTPD_AUTH_SUPPORT if (STATE->auth_state == PAM_DENIED && STATE->handler != httpd_handle_401) { httpd_cleanup(); STATE->handler = httpd_handle_401; STATE->header_reparse = 0; printf("httpd: auth failed/n"); } else if (STATE->auth_state == PAM_PENDING) return; /* Waiting for the PAM Layer */#endif if (uip_rexmit() || uip_newdata() || uip_acked() || uip_poll() || uip_connected()) { /* Call associated handler, if set already. */ if (STATE->handler && (!STATE->header_reparse)) STATE->handler(); }}
开发者ID:AnDann,项目名称:ethersex,代码行数:59,
示例18: yport_net_mainvoid yport_net_main(void){ if(uip_connected()) { if (yport_conn == NULL) { yport_conn = uip_conn; uip_conn->wnd = YPORT_BUFFER_LEN - 1; } else /* if we have already an connection, send an error */ uip_send("ERROR: Connection blocked/n", 27); } else if (uip_acked()) { /* If the peer is not our connection, close it */ if (yport_conn != uip_conn) uip_close(); else { /* Some data we have sent was acked, jipphie */ /* disable interrupts */ uint8_t sreg = SREG; cli(); yport_recv_buffer.len -= yport_recv_buffer.sent; /* We should use memmove, because the data may overlap */ memmove(yport_recv_buffer.data, yport_recv_buffer.data + yport_recv_buffer.sent, yport_recv_buffer.len); /* enable interrupts again */ SREG = sreg; } } else if (uip_closed() || uip_aborted() || uip_timedout()) { /* if the closed connection was our connection, clean yport_conn */ if (yport_conn == uip_conn) yport_conn = NULL; } else if (uip_newdata()) { if (uip_len <= YPORT_BUFFER_LEN && yport_rxstart(uip_appdata, uip_len) != 0) { /* Prevent the other side from sending more data */ uip_stop(); } } if (uip_poll() && uip_conn == yport_conn && uip_stopped(yport_conn) && yport_send_buffer.sent == yport_send_buffer.len) uip_restart(); /* Send data */ if ((uip_poll() || uip_acked() || uip_rexmit()) && yport_conn == uip_conn && yport_recv_buffer.len > 0) { /* We have recieved data, lets propagade it */ /* disable interrupts */ uint8_t sreg = SREG; cli(); /* Send the data */ uip_send(yport_recv_buffer.data, yport_recv_buffer.len); /* so many data was send */ yport_recv_buffer.sent = yport_recv_buffer.len; /* enable interrupts again */ SREG = sreg; }}
开发者ID:muccc,项目名称:matemat,代码行数:58,
示例19: jabber_mainstatic voidjabber_main(void){ if (uip_aborted() || uip_timedout()) { JABDEBUG("connection aborted/n"); jabber_conn = NULL; } if (uip_closed()) { JABDEBUG("connection closed/n"); jabber_conn = NULL; } if (uip_connected()) { JABDEBUG("new connection/n"); STATE->stage = JABBER_OPEN_STREAM; STATE->sent = JABBER_INIT;#ifdef JABBER_STARTUP_MESSAGE_SUPPORT strncpy_P(STATE->target, PSTR(CONF_JABBER_BUDDY), sizeof(STATE->target)); strncpy_P(STATE->outbuf, jabber_startup_text, sizeof(STATE->outbuf)); STATE->action = JABBER_ACTION_MESSAGE;#endif /* JABBER_STARTUP_MESSAGE_SUPPORT */ } if (uip_acked() && STATE->stage == JABBER_CONNECTED) { STATE->action = JABBER_ACTION_NONE; *STATE->outbuf = 0; } if (uip_newdata() && uip_len) { /* Zero-terminate */ ((char *) uip_appdata)[uip_len] = 0; JABDEBUG("received data: %s/n", uip_appdata); if (jabber_parse()) { uip_close(); /* Parse error */ return; } } if (uip_rexmit()) jabber_send_data(STATE->stage, STATE->action); else if ((STATE->stage > STATE->sent || STATE->stage == JABBER_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) jabber_send_data(STATE->stage, STATE->action); else if (STATE->stage == JABBER_CONNECTED && uip_poll() && STATE->action) jabber_send_data(STATE->stage, STATE->action);}
开发者ID:AnDann,项目名称:ethersex,代码行数:57,
示例20: telnetd_appcall/*---------------------------------------------------------------------------*/voidtelnetd_appcall(void *ts){ if(uip_connected()) { if(!connected) { buf_init(&buf); s.bufptr = 0; s.state = STATE_NORMAL; connected = 1; shell_start(); timer_set(&s.silence_timer, MAX_SILENCE_TIME); ts = (char *)0; } else { uip_send(telnetd_reject_text, strlen(telnetd_reject_text)); ts = (char *)1; } tcp_markconn(uip_conn, ts); } if(!ts) { if(s.state == STATE_CLOSE) { s.state = STATE_NORMAL; uip_close(); return; } if(uip_closed() || uip_aborted() || uip_timedout()) { shell_stop(); connected = 0; } if(uip_acked()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); acked(); } if(uip_newdata()) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked() || uip_connected() || uip_poll()) { senddata(); if(s.numsent > 0) { timer_set(&s.silence_timer, MAX_SILENCE_TIME); } } if(uip_poll()) { if(timer_expired(&s.silence_timer)) { uip_close(); tcp_markconn(uip_conn, NULL); } } }}
开发者ID:Abdellazizhammami,项目名称:contiki,代码行数:58,
示例21: appcall/*---------------------------------------------------------------------------*/static voidappcall(void *state){ if(uip_closed() || uip_aborted() || uip_timedout()) { ctkmode(); } else if(uip_connected()) { } else { handle_input(); handle_output(); }}
开发者ID:kincki,项目名称:contiki,代码行数:12,
示例22: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void *state){#if DEBUGLOGIC struct httpd_state *s; //Enter here for debugging with output directed to TCPBUF s = sg = (struct httpd_state *)memb_alloc(&conns); if (1) {#else struct httpd_state *s = (struct httpd_state *)state; if(uip_closed() || uip_aborted() || uip_timedout()) { if(s != NULL) { memb_free(&conns, s); } } else if(uip_connected()) { s = (struct httpd_state *)memb_alloc(&conns); if(s == NULL) { uip_abort(); return; }#endif tcp_markconn(uip_conn, s); PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->state = STATE_WAITING; /* timer_set(&s->timer, CLOCK_SECOND * 100);*/ s->timer = 0; handle_connection(s); } else if(s != NULL) { if(uip_poll()) { ++s->timer; if(s->timer >= 20) { uip_abort(); memb_free(&conns, s); } } else { s->timer = 0; } handle_connection(s); } else { uip_abort(); }}/*---------------------------------------------------------------------------*/voidhttpd_init(void){ tcp_listen(UIP_HTONS(80)); memb_init(&conns); httpd_cgi_init();}
开发者ID:Ammar-85,项目名称:contiki-arduino,代码行数:52,
示例23: exosite_appcall/******************************************************************************* void exosite_appcall(void)** This function is uIP's application function. It is called whenever a uIP * event occurs (e.g. when a new connection is established, new data arrives, * sent data is acknowledged, data needs to be retransmitted, etc.).* ******************************************************************************/ void exosite_appcall(void){ if(uip_connected()) { s.timer = 0; senddata(); return; } if(s.state == EXO_STATE_CLOSE) { uip_abort(); return; } if(uip_aborted()) { } if(uip_timedout()) { } if(uip_acked()) { s.timer = 0; acked(); } if(uip_newdata()) { s.timer = 0; newdata(); } if(uip_rexmit() || uip_newdata() || uip_acked()) { senddata(); } else if(uip_poll()) { ++s.timer; if(s.timer == EXO_TIMEOUT) { uip_abort(); return; } }#if 0 if(uip_closed()) { if(s.httpflag != HTTPFLAG_MOVED) { memset(s.rxdata,0,sizeof(s.rxdata)); } else { if(resolv_lookup(s.host) == NULL) { resolv_query(s.host); } } }#endif}
开发者ID:exosite-garage,项目名称:rx62n_pmod_cloud,代码行数:58,
示例24: smtp_appcall/*---------------------------------------------------------------------------*/voidsmtp_appcall(void){ if(uip_closed()) { s.connected = 0; return; } if(uip_aborted() || uip_timedout()) { s.connected = 0; smtp_done(1); return; } smtp_thread();}
开发者ID:ichpuchtli,项目名称:freeburn,代码行数:15,
示例25: mysql_mainstatic voidmysql_main(void){ if (uip_aborted() || uip_timedout()) { MYDEBUG ("connection aborted/n"); mysql_conn = NULL; } if (uip_closed()) { MYDEBUG ("connection closed/n"); mysql_conn = NULL; } if (uip_connected()) { MYDEBUG ("new connection/n"); STATE->stage = MYSQL_WAIT_GREETING; STATE->sent = MYSQL_WAIT_GREETING; STATE->packetid = 0; } if (uip_newdata() && uip_len) {#ifdef DEBUG_MYSQL MYDEBUG ("received data: %s/n", uip_appdata); for (uint16_t i = 0; i < uip_len; i ++) debug_putchar (((unsigned char *) uip_appdata)[i]); debug_putchar (10);#endif if (mysql_parse ()) { uip_close (); /* Parse error */ return; } } if (uip_rexmit()) { STATE->packetid --; mysql_send_data (STATE->sent); } else if ((STATE->stage > STATE->sent || STATE->stage == MYSQL_CONNECTED) && (uip_newdata() || uip_acked() || uip_connected())) mysql_send_data (STATE->stage); else if (STATE->stage == MYSQL_CONNECTED && uip_poll() && *STATE->u.stmtbuf) mysql_send_data(STATE->stage);}
开发者ID:simeonfelis,项目名称:ethersex,代码行数:48,
示例26: httpd_appcall/*---------------------------------------------------------------------------*/voidhttpd_appcall(void *state){ struct httpd_state *s = (struct httpd_state *)state; if(uip_closed() || uip_aborted() || uip_timedout()) { if(s != NULL) { if(s->fd >= 0) { cfs_close(s->fd); s->fd = -1; } memb_free(&conns, s); } } else if(uip_connected()) { s = (struct httpd_state *)memb_alloc(&conns); if(s == NULL) { uip_abort(); webserver_log_file(&uip_conn->ripaddr, "reset (no memory block)"); return; } tcp_markconn(uip_conn, s); PSOCK_INIT(&s->sin, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PSOCK_INIT(&s->sout, (uint8_t *)s->inputbuf, sizeof(s->inputbuf) - 1); PT_INIT(&s->outputpt); s->fd = -1; s->state = STATE_WAITING; timer_set(&s->timer, CLOCK_SECOND * 10); handle_connection(s); } else if(s != NULL) { if(uip_poll()) { if(timer_expired(&s->timer)) { uip_abort(); if(s->fd >= 0) { cfs_close(s->fd); s->fd = -1; } memb_free(&conns, s); webserver_log_file(&uip_conn->ripaddr, "reset (timeout)"); } } else { timer_restart(&s->timer); } handle_connection(s); } else { uip_abort(); }}
开发者ID:arbraham,项目名称:hummingbird,代码行数:48,
示例27: mqttclient_appcallvoid mqttclient_appcall(void) { if (uip_poll()) { _mqttclient_transfer_buffer(); } else if (uip_connected()) { update_state(MQTTCLIENT_BROKER_CONNECTION_ESTABLISHED); umqtt_connect(&_mqtt, &_connection_config); _mqttclient_transfer_buffer(); } else if (uip_aborted() || uip_timedout() || uip_closed()) { _mqttclient_handle_communication_error(); } else if (uip_newdata()) { _mqttclient_handle_new_data(); } else if (uip_acked()) { _is_sending = false; } else if (uip_rexmit()) { _mqttclient_send(); }}
开发者ID:mcmatrix,项目名称:avr-dht22-node,代码行数:17,
示例28: socket_app_appcall/* * In socketapp.h we have defined the UIP_APPCALL macro to * socket_app_appcall so that this function is uIP's application * function. This function is called whenever an uIP event occurs * (e.g. when a new connection is established, new data arrives, sent * data is acknowledged, data needs to be retransmitted, etc.). */void socket_app_appcall( void ){ /* * The uip_conn structure has a field called "appstate" that holds * the application state of the connection. We make a pointer to * this to access it easier. */ struct socket_app_state *s = &(uip_conn->appstate); /* * If a new connection was just established, we should initialize * the protosocket in our applications' state structure. */ if ( uip_connected() ) { s->no = counter++; memset( buffer, 0, sizeof(buffer)); WiFi_connected( s->no ); } /** * Neue Daten anstehend */ else if ( uip_newdata() ) { memset( buffer, 0, sizeof(buffer) ); int length = uip_datalen(); int i = 0; while ( i < length && i < sizeof(buffer) ) { if ( ((char *) uip_appdata)[i] == '/r' ) continue; if ( ((char *) uip_appdata)[i] == '/n' ) break; buffer[i] = ((char *) uip_appdata)[i]; i++; } WiFi_newData( s->no, buffer, length ); } /** * Verbindung wird geschlossen */ else if ( uip_aborted() || uip_closed() ) { WiFi_closed( s->no ); }}
开发者ID:BackupTheBerlios,项目名称:microsrcp,代码行数:53,
注:本文中的uip_aborted函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ uip_acked函数代码示例 C++ uip_abort函数代码示例 |