src/nettools/daemon/daemon.c File Reference

This file implements a simple network daemon. More...


Data Structures

struct  DREC
 The structure describes the Daemon Entry. More...
struct  _child
 The structure describes the data instance for daemon child task. More...

Typedefs

typedef _child CHILD
 The structure describes the data instance for daemon child task.

Functions

HANDLE DaemonNew (uint Type, IPN LocalAddress, uint LocalPort, int(*pCb)(SOCKET, UINT32), uint Priority, uint StackSize, UINT32 Argument, uint MaxSpawn)
void DaemonFree (HANDLE hEntry)
HANDLE Daemon6New (uint Type, IP6N LocalAddress, uint LocalPort, int(*pCb)(SOCKET, UINT32), uint Priority, uint StackSize, UINT32 Argument, uint MaxSpawn)
void Daemon6Free (HANDLE hEntry)


Detailed Description

This file implements a simple network daemon.

NOTE: (C) Copyright 2008, Texas Instruments, Inc.

Function Documentation

void Daemon6Free ( HANDLE  hEntry  ) 

Description
The function is to used cleanup a previously created V6 daemon.

Parameters:
[in] hEntry This is the handle to the daemon which was previously created using Daemon6New
See also:
Daemon6New
Return values:
Not Applicable.

HANDLE Daemon6New ( uint  Type,
IP6N  LocalAddress,
uint  LocalPort,
int(*)(SOCKET, UINT32)  pCb,
uint  Priority,
uint  StackSize,
UINT32  Argument,
uint  MaxSpawn 
)

Description
The function creates a V6 Daemon.

Parameters:
[in] Type This is the type of socket being opened through the daemon. In the case of IPv6 the following types are supported
  • SOCK_STREAM Use this for TCP Sockets.
  • SOCK_DGRAM Use this for UDP Sockets.
[in] LocalAddress This is the Local Address to which the socket will be bound to. In most cases this is typically passed as IPV6_UNSPECIFIED_ADDRESS
[in] LocalPort This is the Local Port to serve (cannot be NULL)
[in] pCb Call back function which is to be invoked.
[in] Priority Priority of new task to create for callback function
[in] StackSize Stack size of new task to create for callback function
[in] Argument Argument (besides socket) to pass to callback function
[in] MaxSpawn Maximum number of callback function instances (must be 1 for UDP)
Return values:
Success - Handle to the spawned Daemon.
Error - 0

void DaemonFree ( HANDLE  hEntry  ) 

Description
The function is to used cleanup a previously created V4 daemon.

Parameters:
[in] hEntry This is the handle to the daemon which was previously created using DaemonNew
See also:
DaemonNew
Return values:
Not Applicable.

HANDLE DaemonNew ( uint  Type,
IPN  LocalAddress,
uint  LocalPort,
int(*)(SOCKET, UINT32)  pCb,
uint  Priority,
uint  StackSize,
UINT32  Argument,
uint  MaxSpawn 
)

Description
The function creates a V4 Daemon.

Parameters:
[in] Type This is the type of socket being opened through the daemon. In the case of IPv4 all socket types are supported i.e. SOCK_STREAM, SOCK_STREAMNC and SOCK_DGRAM.
[in] LocalAddress This is the Local Address to which the socket will be bound to. In most cases this is typically passed as NULL.
[in] LocalPort This is the Local Port to serve (cannot be NULL)
[in] pCb Call back function which is to be invoked.
[in] Priority Priority of new task to create for callback function
[in] StackSize Stack size of new task to create for callback function
[in] Argument Argument (besides socket) to pass to callback function
[in] MaxSpawn Maximum number of callback function instances (must be 1 for UDP)
Return values:
Success - Handle to the spawned Daemon.
Error - 0


Copyright 2009, Texas Instruments Incorporated