# echo.c File Reference

The functions in this file maintains the TCP echo server. 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 "server.h"`
`#include "echo.h"`

Include dependency graph for echo.c:

## Defines
#define | ECHO_PORT 7
| Standard TCP Echo Service Port.
#define | BUFSIZE 512
| User defined TCP transmission queue buffer size.
#define | EchoMSG "ECHO"
| default message to print to the LCD
## Functions
void | tcpEcho_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 | TCPecho_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]

## Detailed Description

The functions in this file maintains the TCP echo server.

## Define Documentation

#define BUFSIZE 512

User defined TCP transmission queue buffer size.

#define ECHO_PORT 7

Standard TCP Echo Service Port.

#define EchoMSG "ECHO"

default message to print to the LCD

## Function Documentation

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 tcpEcho_handler | ( | event_t | event,
|  | void * | cbargs,
|  | void * | context |
| ) |  |  |

tcpEcho_handler

Implements the TCP state machine to for TCP connection

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 TCPecho_init | ( |  | ) |

initializes the TCP socket

TCPecho_init

Parameters:

  | none |

Returns:
  none

Here is the call graph for this function:

## Variable Documentation

tcp_event_t g_app_tcp_event`[static]`

TCP event descriptor.

sockaddr_in6_t g_localaddr`[static]`

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.