src/stack/res6/sb6.c File Reference

The file implements the Socket Buffer for IPv6. More...


Functions

HANDLE SB6New (INT32 Max, INT32 Min, uint Mode)
void SB6Free (HANDLE h)
void SB6Flush (HANDLE h, uint fFree)
INT32 SB6Read (HANDLE h, INT32 Size, INT32 Off, UINT8 *pbDst, PSA_IN6 pPeer, UINT8 flagPeek)
INT32 SB6Write (HANDLE h, INT32 Size, void *pData, PBM_Pkt *pPkt)
INT32 SB6SetMax (HANDLE h, INT32 Max)


Detailed Description

The file implements the Socket Buffer for IPv6.

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

Function Documentation

void SB6Flush ( HANDLE  h,
uint  fFree 
)

Description
The function is called to flush out all data in the socket buffers. The function is similar to SB6Free except it does not clean out the SOCKET Buffer object itself.

Parameters:
[in] h Handle to the socket buffer object
[in] fFree Flag which indicates how to handle internal SB memory. When set to 1 the function will clean up the internal memory and when passed as 0; the internal memory block will be retained
Return values:
Not Applicable.

void SB6Free ( HANDLE  h  ) 

Description
The function is called to cleanup the socket buffer object for V6.

Parameters:
[in] h Handle to the socket buffer object which is to be cleaned up.
Return values:
Not Applicable.

HANDLE SB6New ( INT32  Max,
INT32  Min,
uint  Mode 
)

Description
The function is called to create a new socket buffer for the IPv6 socket layer.

Parameters:
[in] Max Sets the Maximum Buffer size.
[in] Min Sets the Minimum Buffer size
[in] Mode This defines the mode in which the Socket Buffer will operate. Valid values for these are as follows:-
  • SB_MODE_LINEAR In this mode there is a single buffer and data is copied into it. This is used for TCP sockets.
  • SB_MODE_ATOMIC In this mode the received packets are enqueued into a linked list This is used for UDP sockets.
Return values:
Success - 0
Error - Non Zero

INT32 SB6Read ( HANDLE  h,
INT32  Size,
INT32  Off,
UINT8 *  pbDst,
PSA_IN6  pPeer,
UINT8  flagPeek 
)

Description
The function is called to read data from the Socket Buffer object.

Parameters:
[in] h Handle to the socket buffer object
[in] Size Size of the Buffer in which data has to be copied.
[in] Off Offset
[in] pbDst Pointer to the destination where the data has to be copied to.
[in] pPeer Pointer to the peer information record; where information about the peer is recorded.
[in] flagPeek Flag which indicates if the function was just called to PEEK or READ. In PEEK i.e. flagPeek = 0 the pointers in the SOCKET buffer object are not updated.
Return values:
Error - 0
Success - Number of bytes read and copied into the supplied buffer.

INT32 SB6SetMax ( HANDLE  h,
INT32  Max 
)

Description
The function sets the max bytes held in the socket buffer.

Parameters:
[in] h Handle to the socket buffer object
[in] Max New MAXIMUM Size
Return values:
Success - Returns the same value as 'Max'
Error - Returns the original value i.e. '!Max'

INT32 SB6Write ( HANDLE  h,
INT32  Size,
void *  pData,
PBM_Pkt *  pPkt 
)

Description
The function is called to write data to the Socket Buffer object.

Parameters:
[in] h Handle to the socket buffer object
[in] Size Size of the Buffer from where data has to be copied.
[in] pData Pointer to where the data payload starts.
[in] pPkt Pointer to received packet whose data payload is added to the socket buffer.
Return values:
Error - 0
Success - Number of bytes copied into the socket buffer.


Copyright 2009, Texas Instruments Incorporated