Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

tcpip.c File Reference

#include "lwip/opt.h"
#include "lwip/sys.h"
#include "lwip/memp.h"
#include "lwip/pbuf.h"
#include "lwip/ip.h"
#include "lwip/udp.h"
#include "lwip/tcp.h"
#include "lwip/tcpip.h"

Include dependency graph for tcpip.c:

Go to the source code of this file.

Functions

void tcpip_thread (void *arg)
err_t tcpip_input (struct pbuf *p, struct netif *inp)
err_t tcpip_callback (void(*f)(void *ctx), void *ctx)
void tcpip_apimsg (struct api_msg *apimsg)
void tcpip_init (void(*initfunc)(void *), void *arg)

Variables

void(* tcpip_init_done )(void *arg)=NULL
void * tcpip_init_done_arg
sys_mbox_t mbox


Function Documentation

void tcpip_apimsg struct api_msg apimsg  ) 
 

Definition at line 159 of file tcpip.c.

References mbox, MEMP_API_MSG, memp_free(), memp_mallocp(), MEMP_TCPIP_MSG, NULL, sys_mbox_post(), and TCPIP_MSG_API.

Referenced by api_msg_post().

00160 {
00161   struct tcpip_msg *msg;
00162   msg = memp_mallocp(MEMP_TCPIP_MSG);
00163   if(msg == NULL) {
00164     memp_free(MEMP_API_MSG, apimsg);
00165     return;
00166   }
00167   msg->type = TCPIP_MSG_API;
00168   msg->msg.apimsg = apimsg;
00169   sys_mbox_post(mbox, msg);
00170 }

Here is the call graph for this function:

err_t tcpip_callback void(*  f)(void *ctx),
void *  ctx
 

Definition at line 142 of file tcpip.c.

References ERR_MEM, ERR_OK, mbox, memp_mallocp(), MEMP_TCPIP_MSG, NULL, sys_mbox_post(), and TCPIP_MSG_CALLBACK.

00143 {
00144   struct tcpip_msg *msg;
00145   
00146   msg = memp_mallocp(MEMP_TCPIP_MSG);
00147   if(msg == NULL) {
00148     return ERR_MEM;  
00149   }
00150   
00151   msg->type = TCPIP_MSG_CALLBACK;
00152   msg->msg.cb.f = f;
00153   msg->msg.cb.ctx = ctx;
00154   sys_mbox_post(mbox, msg);
00155   return ERR_OK;
00156 }

Here is the call graph for this function:

void tcpip_init void(*  initfunc)(void *),
void *  arg
 

Definition at line 173 of file tcpip.c.

References mbox, NULL, sys_mbox_new(), sys_thread_new(), tcpip_init_done, tcpip_init_done_arg, and tcpip_thread().

00174 {
00175   tcpip_init_done = initfunc;
00176   tcpip_init_done_arg = arg;
00177   mbox = sys_mbox_new();
00178   sys_thread_new((void *)tcpip_thread, NULL, 0);
00179 
00180 }

Here is the call graph for this function:

err_t tcpip_input struct pbuf p,
struct netif inp
 

Definition at line 124 of file tcpip.c.

References ERR_MEM, ERR_OK, mbox, memp_mallocp(), MEMP_TCPIP_MSG, NULL, pbuf_free(), sys_mbox_post(), and TCPIP_MSG_INPUT.

00125 {
00126   struct tcpip_msg *msg;
00127   
00128   msg = memp_mallocp(MEMP_TCPIP_MSG);
00129   if(msg == NULL) {
00130     pbuf_free(p);    
00131     return ERR_MEM;  
00132   }
00133   
00134   msg->type = TCPIP_MSG_INPUT;
00135   msg->msg.inp.p = p;
00136   msg->msg.inp.netif = inp;
00137   sys_mbox_post(mbox, msg);
00138   return ERR_OK;
00139 }

Here is the call graph for this function:

void tcpip_thread void *  arg  )  [static]
 

Definition at line 83 of file tcpip.c.

References api_msg_input(), DEBUGF, ip_init(), ip_input(), mbox, memp_freep(), MEMP_TCPIP_MSG, NULL, sys_mbox_fetch(), sys_timeout(), sys_timeout_handler, tcp_init(), TCP_TMR_INTERVAL, TCPIP_DEBUG, tcpip_init_done, tcpip_init_done_arg, TCPIP_MSG_API, TCPIP_MSG_CALLBACK, TCPIP_MSG_INPUT, and udp_init().

Referenced by tcpip_init().

00084 {
00085   struct tcpip_msg *msg;
00086 
00087   (void)arg;
00088 
00089   ip_init();
00090 #if LWIP_UDP  
00091   udp_init();
00092 #endif
00093 #if LWIP_TCP
00094   tcp_init();
00095   sys_timeout(TCP_TMR_INTERVAL, (sys_timeout_handler)tcpip_tcp_timer, NULL);
00096 #endif
00097   if(tcpip_init_done != NULL) {
00098     tcpip_init_done(tcpip_init_done_arg);
00099   }
00100 
00101   while(1) {                          /* MAIN Loop */
00102     sys_mbox_fetch(mbox, (void *)&msg);
00103     switch(msg->type) {
00104     case TCPIP_MSG_API:
00105       DEBUGF(TCPIP_DEBUG, ("tcpip_thread: API message %p\n", (void *)msg));
00106       api_msg_input(msg->msg.apimsg);
00107       break;
00108     case TCPIP_MSG_INPUT:
00109       DEBUGF(TCPIP_DEBUG, ("tcpip_thread: IP packet %p\n", (void *)msg));
00110       ip_input(msg->msg.inp.p, msg->msg.inp.netif);
00111       break;
00112     case TCPIP_MSG_CALLBACK:
00113       DEBUGF(TCPIP_DEBUG, ("tcpip_thread: CALLBACK %p\n", (void *)msg));
00114       msg->msg.cb.f(msg->msg.cb.ctx);
00115       break;
00116     default:
00117       break;
00118     }
00119     memp_freep(MEMP_TCPIP_MSG, msg);
00120   }
00121 }

Here is the call graph for this function:


Variable Documentation

sys_mbox_t mbox [static]
 

Definition at line 54 of file tcpip.c.

Referenced by tcpip_apimsg(), tcpip_callback(), tcpip_init(), tcpip_input(), and tcpip_thread().

void(* tcpip_init_done)(void *arg) = NULL [static]
 

Definition at line 52 of file tcpip.c.

Referenced by tcpip_init(), and tcpip_thread().

void* tcpip_init_done_arg [static]
 

Definition at line 53 of file tcpip.c.

Referenced by tcpip_init(), and tcpip_thread().


Generated on Wed Jan 14 12:59:15 2004 for RTL-lwIP-0.4 by doxygen 1.3.4