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

tcpserver.c File Reference

#include <linux/module.h>
#include <linux/kernel.h>
#include "lwip/sys.h"
#include "lwip/api.h"
#include <rtl_sched.h>
#include <rtl_debug.h>

Include dependency graph for tcpserver.c:

Go to the source code of this file.

Functions

void tcpecho_thread (void *arg)
int init_module (void)
void cleanup_module (void)

Variables

netconnconn
netconnnewconn
pthread_t sequential_tcpserver_thread


Function Documentation

void cleanup_module void   ) 
 

Definition at line 68 of file tcpserver.c.

References conn, netconn_delete(), sequential_tcpserver_thread, and sys_thread_delete().

00068                          {
00069   sys_thread_delete((void *) sequential_tcpserver_thread);
00070   netconn_delete(conn);
00071   printk("\n\nEcho TCP server module removed.\n\n"); 
00072 }

Here is the call graph for this function:

int init_module void   ) 
 

Definition at line 61 of file tcpserver.c.

References NULL, sequential_tcpserver_thread, sys_thread_new(), and tcpecho_thread().

00061                      {
00062   printk("\n\nEcho TCP server module being inserted.\n\n"); 
00063   sequential_tcpserver_thread = (pthread_t) sys_thread_new(tcpecho_thread, NULL, 0);
00064   return 0;
00065 }

Here is the call graph for this function:

void tcpecho_thread void *  arg  )  [static]
 

Definition at line 21 of file tcpserver.c.

References conn, data, len, netbuf_data(), netbuf_delete(), netbuf_next(), netconn_accept(), netconn_bind(), netconn_listen(), netconn_new(), netconn_recv(), NETCONN_TCP, newconn, NULL, and u16_t.

Referenced by init_module().

00022 {
00023 
00024   rtl_printf("\n\nEcho TCP server module inserted 0x%x.\n\n", (unsigned int) pthread_self()); 
00025 
00026   /* Create a new connection identifier. */
00027   conn = netconn_new(NETCONN_TCP);
00028   
00029   /* Bind connection to well known port number 7. */
00030   netconn_bind(conn, NULL, 7);
00031 
00032   /* Tell connection to go into listening mode. */
00033   netconn_listen(conn);
00034 
00035   while(1) {
00036 
00037     /* Grab new connection. */
00038     newconn = netconn_accept(conn);
00039 
00040     /* Process the new connection. */
00041     if(newconn != NULL) {
00042       struct netbuf *buf;
00043       void *data;
00044       u16_t len;
00045 
00046       while((buf = netconn_recv(newconn)) != NULL) {
00047         do {
00048           netbuf_data(buf, &data, &len);
00049           rtl_printf("\n\n\n\n\n---------------Echo TCP server receiving: %s --------------------\n\n\n\n\n",data);
00050         } while(netbuf_next(buf) >= 0);
00051         netbuf_delete(buf);     
00052       }
00053     }
00054   }
00055 }

Here is the call graph for this function:


Variable Documentation

struct netconn* conn
 

Definition at line 16 of file tcpserver.c.

Referenced by cleanup_module(), event_callback(), lwip_socket(), netconn_accept(), netconn_addr(), netconn_bind(), netconn_close(), netconn_connect(), netconn_delete(), netconn_disconnect(), netconn_err(), netconn_listen(), netconn_new(), netconn_new_with_callback(), netconn_peer(), netconn_recv(), netconn_send(), netconn_type(), netconn_write(), tcp_client(), tcpecho_thread(), udpclient(), and udpecho_thread().

struct netconn * newconn
 

Definition at line 16 of file tcpserver.c.

Referenced by alloc_socket(), lwip_accept(), netconn_accept(), serve_echo(), and tcpecho_thread().

pthread_t sequential_tcpserver_thread
 

Definition at line 17 of file tcpserver.c.

Referenced by cleanup_module(), and init_module().


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