CPSSoc

Definitions

#include <nitroWiFi/cps.h>
typedef struct _CPSSoc {
OSThread *thread;			// Owner of this socket
u32 block_type;
u8 state;				// socket state
u8 ssl;				// TCP if 0, SSL otherwise
u16 local_port;			// my port number
void *con;				// SSL connection information
u32 when;				// when this was created (SYN sent/recvd)
u32 local_ip_real;			// real IP that the packet is sent to
u16 remote_port;			// his port number
u16 remote_port_bound;		// port number specified by CPS_SocBind()
CPSInAddr remote_ip;		// his IP address
CPSInAddr remote_ip_bound;		// IP address specified by CPS_SocBind()
u32 ackno;				// my ACK number (i.e., received so far)
u32 seqno;				// my SEQ number (i.e., sent so far)
u16 remote_win;			// his window size
u16 remote_mss;			// his MSS
u32 remote_ackno;			// his ACK number (i.e., acked so far)
u32 ackrcvd;			// # of ACKs received so far (for slow start)
int (*udpread_callback) (u8 *, u32, struct _CPSSoc *);
CPSSocBuf rcvbuf;			// Low level receive buffer (filled by TCP state machine or UDP)

u32 rcvbufp;			// index to rcvbuf.data[] (0 based)
CPSSocBuf sndbuf;			// Low level send buffer (used by packet sender)
CPSSocBuf linbuf;			// High level line input buffer
CPSSocBuf outbuf;			// High level output buffer for buffered-output
u32 outbufp;			// index to outbuf.data[]
} CPSSoc;

Description

Structure that defines the socket. The fields inside OSThread point to this socket. The system configures most of the fields, but the application must set the buffer region and some other fields.

rcvbuf Required. The receive buffer area returned by CPS_SocRead(). The TCP window size depends on the size of this area. UDP packets and ICMP echo reply packets larger than rcvbuf are shortened.
sndbuf Required. Send packet buffer to be passed to ARM7. Must prepare the maximum packet length of packets output by the application for each thread (including IP header, etc.) plus 14 bytes. Normally, set this to 1514 bytes.
linbuf Optional. Must provide the maximum length of the line that will be handled plus 1 byte only if using CPS_SocGets().
outbuf Optional. Secure appropriate size only if using CPS_SocPutChar(), CPS_SocPuts(), and CPS_SocPrintf(). Making this twice the size of mymss will improve efficiency.
con Set the pointer to the CPSSslConnection structure when using SSL.

During the UDP communications, the following fields can be used inside udpread_callback() to control the bind states of ports and IP addresses. For further details, see the descriptions for CPS_SetUdpCallback() and CPS_SocBind().

remote_port The actual port number of the partner.
remote_ip The actual IPv4 address of the partner.
remote_port_bound The port number of the partner as specified by CPS_SocBind().
remote_ip_bound The IPv4 address of the partner as specified by CPS_SocBind().

See Also

CPS_SocRegister, CPS_SocUse, CPS_SocRelease, CPS_SetUdpCallback, CPS_SocBind, CPS_SocWrite, CPSSocBuf, CPSSslConnection, CPS Library Types

Revision History

10/24/2005 Initial version.