shell.c File Reference

Manages the TCP connection, also initializes the Command Shell service upon startup. More...

#include <sys/svcs.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <notifychange.h>
#include <string.h>
#include <stdio.h>
#include <unistd.h>
#include <netinet/inet.h>
#include <iwconfig.h>
#include <raven.h>
#include "ieee802154.h"
#include "uart.h"
#include "cmd.h"
#include "server.h"
#include "shell.h"

Include dependency graph for shell.c:


Defines

#define TELNET_PORT   23
 Standard TCP Telnet Service Port.
#define BUFSIZE   512
 User defined TCP transmission queue buffer size.
#define CMDLINESIZE   256
 User defined command line size.

Enumerations

enum  { TELNET_WILL = 251, TELNET_IAC = 255 }
enum  { IAC = 1, WILL = 2 }
enum  tcp_state_enum { TCPOPEN, TCPCONN, TCPCLOSE }
 Enumeration of TCP states. More...

Functions

void __main (event_t event, void *cbargs, void *context)
void tcp_handler (event_t event, void *cbargs, void *context)
void err_handler (event_t event, void *cbargs, void *context)
 Notification that send may be possible again.
void iwconfig_handler (event_t event, void *cbargs, void *context)
void timer_handler (event_t event, void *cbargs, void *context)
void tcp_telnet_handler (event_t event, void *cbargs, void *context)
 Implements the TCP state machine to for TCP connection.
void telnet_init ()
 initializes the TCP socket

Variables

static int16_t g_sockfd
 Socket ID.
static sockaddr_in6_t g_localaddr
 Local Socket Address.
static tcp_event_t g_app_tcp_event
 TCP event descriptor.
static uint8_t g_tcpbuf [BUFSIZE]
static uint8_t g_cmdline_index
 Current index into the command line buffer.
static char g_cmdline [CMDLINESIZE]
 Command line buffer.
enum tcp_state_enum tcp_state
 Global variable to keep track of the current TCP state machine.

Detailed Description

Manages the TCP connection, also initializes the Command Shell service upon startup.


Define Documentation

#define BUFSIZE   512

User defined TCP transmission queue buffer size.

#define CMDLINESIZE   256

User defined command line size.

#define TELNET_PORT   23

Standard TCP Telnet Service Port.


Enumeration Type Documentation

anonymous enum

Enumerator:
TELNET_WILL 
TELNET_IAC 

anonymous enum

Enumerator:
IAC 
WILL 

Enumeration of TCP states.

Enumerator:
TCPOPEN 
TCPCONN 
TCPCLOSE 


Function Documentation

void __main ( event_t  event,
void *  cbargs,
void *  context 
)

void err_handler ( event_t  event,
void *  cbargs,
void *  context 
)

Notification that send may be possible again.

err_handler

Parameters:
event equals to NOTIFYWRITE as this is a notifywrite() callback
cbargs passes resource back from notifywrite() call
context passes context back from notifywrite() call
Returns:
none

Here is the call graph for this function:

void iwconfig_handler ( event_t  event,
void *  cbargs,
void *  context 
)

void tcp_handler ( event_t  event,
void *  cbargs,
void *  context 
)

void tcp_telnet_handler ( event_t  event,
void *  cbargs,
void *  context 
)

Implements the TCP state machine to for TCP connection.

tcp_telnet_handler

Accumulates the cmd line into cmd buffer; processes telnet escape charaters

Parameters:
event equals to TCPBIND as this is a tcpbind() callback
cbargs passes tcp_event back from tcpbind() call
context passes context back from tcpbind() call
Returns:
none

Here is the call graph for this function:

void telnet_init (  ) 

initializes the TCP socket

TCPecho_init

Parameters:
none 
Returns:
none

Here is the call graph for this function:

void timer_handler ( event_t  event,
void *  cbargs,
void *  context 
)


Variable Documentation

TCP event descriptor.

char g_cmdline[CMDLINESIZE] [static]

Command line buffer.

uint8_t g_cmdline_index [static]

Current index into the command line buffer.

Local Socket Address.

int16_t g_sockfd [static]

Socket ID.

uint8_t g_tcpbuf[BUFSIZE] [static]

Pass this buffer for the stack to use as TCP transmission queue buffer for the socket.

Global variable to keep track of the current TCP state machine.


Generated on Wed May 21 18:30:07 2008 for ASD Tutorial Lesson 4: Shell by  doxygen 1.5.5