src/stack/sock6/sock6.c File Reference

The file implements the SOCK6 object which is the socket library for IPv6. More...


Functions

int Sock6New (int Family, int Type, int Protocol, int RxBufSize, int TxBufSize, HANDLE *phSock)
int Sock6Bind (HANDLE h, PSA pName)
int Sock6Recv (HANDLE h, char *pBuf, INT32 size, int flags, PSA pPeer, INT32 *pRetSize)
int Sock6Send (HANDLE h, char *pBuf, INT32 size, int flags, INT32 *pRetSize)
int Sock6Connect (HANDLE h, PSA pName)
void Sock6IntAbort (SOCK6 *ps)
int Sock6Close (HANDLE h)
int Sock6Disconnect (HANDLE h)
int Sock6Check (HANDLE h, int IoType)
int Sock6Status (HANDLE h, int request, int *results)
int Sock6Shutdown (HANDLE h, int how)
int Sock6GetName (HANDLE h, PSA pSockName, PSA pPeerName)
int Sock6Listen (HANDLE h, int maxcon)
int Sock6Accept (HANDLE h, HANDLE *phSock)
int Sock6Set (HANDLE hSock, int Type, int Prop, void *pbuf, int size)
int Sock6Get (HANDLE hSock, int Type, int Prop, void *pbuf, int *psize)


Detailed Description

The file implements the SOCK6 object which is the socket library for IPv6.

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

Function Documentation

int Sock6Accept ( HANDLE  h,
HANDLE *  phSock 
)

Description
The function accepts connections on a socket which is listening for connections to arrive.

Parameters:
[in] h Socket Handle which is listening for connections.
[out] phSock Socket Handle which is created after accepting the connection.
Return values:
Success - 0
Error - Non Zero

int Sock6Bind ( HANDLE  h,
PSA  pName 
)

Description
The function binds an address and port to the socket.

Parameters:
[in] h Socket Handle passed.
[in] pName IPv6 Address and Port Information to which the socket will be bound.
Return values:
Success - 0
Error - Non Zero

int Sock6Check ( HANDLE  h,
int  IoType 
)

Description
The function is called to determine if there is any operation pending on the socket.

Parameters:
[in] h Socket Handle which needs to be checked.
[in] IoType Type of operation which is pending.
Return values:
1 - Operation is pending
0 - Operation is not pending

int Sock6Close ( HANDLE  h  ) 

Description
The function closes an IPv6 Socket.

Parameters:
[in] h Socket Handle which is to be closed.
Return values:
Success - 0
Error - Non Zero

int Sock6Connect ( HANDLE  h,
PSA  pName 
)

Description
The function connects the socket.

Parameters:
[in] h Socket Handle which is to be connected.
[in] pName Socket Address Information to which the socket will be connected.
Return values:
Success - 0
Error - Non Zero

int Sock6Disconnect ( HANDLE  h  ) 

Description
The function disconnects an IPv6 Socket. This is not the same as close; since the socket is not cleaned up.

Parameters:
[in] h Socket Handle which is to be disconnected.
Return values:
Success - 0
Error - Non Zero

int Sock6Get ( HANDLE  hSock,
int  Type,
int  Prop,
void *  pbuf,
int *  psize 
)

Description
The function is used to get the socket parameters

Parameters:
[in] hSock Handle to the socket.
[in] Type Socket Level which is to be configured.
  • SOL_SOCKET: Socket Properties
  • IPPROTO_TCP: TCP Properties
  • IPPROTO_IPV6: IPv6 Properties
[in] Prop The Property which needs to be configured.
[out] pbuf Data buffer where the value of property will be stored.
[out] psize Size of the Data buffer
Return values:
Success - 0
Error - Non Zero

int Sock6GetName ( HANDLE  h,
PSA  pSockName,
PSA  pPeerName 
)

Description
The function gets information about the Local and Peer to which the socket has been connected.

Parameters:
[in] h Socket Handle for which the information is required.
[out] pSockName Local Information is populated in this.
[out] pPeerName Peer Information is populated in this.
Return values:
Always returns 0.

void Sock6IntAbort ( SOCK6 ps  ) 

Description
The function cleans up the internal memory for the V6 Socket.

Parameters:
[in] ps Pointer to the SOCK6 Object which will be cleaned up.
Return values:
Not Applicable.

int Sock6Listen ( HANDLE  h,
int  maxcon 
)

Description
The function listens on STREAM sockets waiting for connections to arrive

Parameters:
[in] h Socket Handle on which connections are being listened for.
[in] maxcon Maximum number of connections that can be accepted.
Return values:
Success - 0
Error - Non Zero

int Sock6New ( int  Family,
int  Type,
int  Protocol,
int  RxBufSize,
int  TxBufSize,
HANDLE *  phSock 
)

Description
The function creates a new IPv6 Socket.

Parameters:
[in] Family Socket Family. Only AF_INET6 is supported.
[in] Type The type of socket being created
  • SOCK_DGRAM : UDP Socket
  • SOCK_STREAM: TCP Socket
  • SOCK_RAW : RAW Socket (TBD)
[in] Protocol Valid Values are 0, IPPROTO_UDP and IPPROTO_TCP.
[in] RxBufSize Receive buffer size of the V6 Socket.
[in] TxBufSize Transmit buffer size of the V6 Socket.
[out] phSock Socket Handle which is returned.
Return values:
Success - 0
Error - Non Zero

int Sock6Recv ( HANDLE  h,
char *  pBuf,
INT32  size,
int  flags,
PSA  pPeer,
INT32 *  pRetSize 
)

Description
The function receives data from a socket.

Parameters:
[in] h Socket Handle from where data has to be read.
[in] pBuf Data Buffer where data has to be copied after it is read from the socket.
[in] size Size of the data buffer passed.
[in] flags Flags
[in] pPeer Peer Information from where the packet was received.
[in] pRetSize Total number of data bytes actually received.
Return values:
Success - 0
Error - Non Zero

int Sock6Send ( HANDLE  h,
char *  pBuf,
INT32  size,
int  flags,
INT32 *  pRetSize 
)

Description
The function send data out from a socket.

Parameters:
[in] h Socket Handle from where data has to be send out
[in] pBuf Data Buffer which contains the data to be sent out.
[in] size Size of the data buffer passed.
[in] flags Flags
[in] pRetSize Total number of data bytes actually sent out.
Return values:
Success - 0
Error - Non Zero

int Sock6Set ( HANDLE  hSock,
int  Type,
int  Prop,
void *  pbuf,
int  size 
)

Description
The function is used to set the socket parameters

Parameters:
[in] hSock Handle to the socket.
[in] Type Socket Level which is to be configured.
  • SOL_SOCKET: Socket Properties
  • IPPROTO_TCP: TCP Properties
  • IPPROTO_IPV6: IPv6 Properties
[in] Prop The Property which needs to be configured.
[in] pbuf Data buffer where the value of property is present
[in] size Size of the Data buffer
Return values:
Success - 0
Error - Non Zero

int Sock6Shutdown ( HANDLE  h,
int  how 
)

Description
The function shuts down the V6 socket.

Parameters:
[in] h Socket Handle which is to be shutdown.
[out] how 
  • SHUT_RD: Closes the Read pipe of the socket
  • SHUT_WR: Closes the Write pipe of the socket
  • SHUT_RDWR: Closes both the Read & Write pipes.
Return values:
Always returns 0.

int Sock6Status ( HANDLE  h,
int  request,
int *  results 
)

Description
The function returns the socket status.

Parameters:
[in] h Socket Handle which needs to be checked.
[in] request Type of request
[out] results Result buffer which has the result of the request.
Return values:
Success - 0
Error - Non Zero


Copyright 2009, Texas Instruments Incorporated