01.06.2013 Views

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

IPC@CHIP Documentation - SC12 @CHIP-RTOS V1.10

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Comments<br />

This data structure and specified constants are defined in the TCPIPAPI.H library header file.<br />

typedef struct tag_getsockopt<br />

{<br />

int protocol_level; // Protocol level: IP level, TCP level or socket level<br />

int optionName; // Option's name<br />

char far *optionValue; // Pointer to the option value buffer (type varies)<br />

int far *optionLength; // Length of option value buffer<br />

} GetSocketOption;<br />

// protocol levels<br />

#define IP_PROTOIP_LEVEL 0<br />

#define IP_PROTOTCP_LEVEL 6<br />

#define SOCKET_LEVEL 0x7fff<br />

// Remaining constants apply to the .optionName field<br />

// IP level options<br />

#define IPO_TTL 0x0001<br />

#define IPO_TOS 0x0002<br />

// TCP level options<br />

#define TCP_NODELAY 0x0001<br />

#define TCP_NOPUSH 0x0004<br />

#define TCP_SLOW_START 0x0200<br />

#define TCP_KEEPALIVE 0x4001<br />

#define TCP_DELAY_ACK 0x4002<br />

#define TCP_KEEPALIVE_INTV 0x4004<br />

#define TCP_KEEPALIVE_CNT 0x4005<br />

#define TCP_FINWT2TIME 0x4006<br />

#define TCP_2MSLTIME 0x4007<br />

#define TCP_MAXRT 0x0010<br />

#define TCP_MAXREXMIT 0x4003<br />

// Socket level options<br />

#define SO_REUSEADDR 0x0004<br />

#define SO_KEEPALIVE 0x0008<br />

#define SO_SNDBUF 0x1001<br />

#define SO_RCVBUF 0x1002<br />

The type of data found at the location referenced by the optionValue member pointer varies depending on the particular<br />

socket option that is being dealt with.<br />

When manipulating socket options, the protocol_level at which the option resides and the name of the option<br />

(optionName member) must be specified. The size of the buffer (in bytes) pointed to by the optionValue member<br />

depends on the option, and this size must be specified in the optionLength field. These sizes are stated in the list of<br />

options below. The API uses the optionValue and optionLength members to report option values.<br />

The following list specifies the three different protocol levels and their valid socket options, including a short description and<br />

the length of the option value. Protocol level and optionName constants referred to here are defined in TCPIPAPI.H header<br />

file.<br />

protocol_level=IP_PROTOIP_LEVEL (IP level options)<br />

❍ optionName=IPO_TOS: Size: 8 bit, sizeof (char) - Set IP type of service, default 0<br />

❍ optionName=IPO_TTL: Size: 8 bit, sizeof (char) - Set IP time-to-live router hops, default 64<br />

protocol_level=IP_PROTOTCP_LEVEL (TCP level options)<br />

❍ optionName=TCP_NODELAY: Size: 16 bit , sizeof (int) - 1: Disable nagle algorithm, default is 0: nagle algorithm is<br />

enabled<br />

❍ optionName=TCP_NOPUSH: Size: 16 bit , sizeof (int) - 1: Force TCP to delay sending any TCP data until a full sized<br />

segment is buffered in the TCP buffers (useful if continuous large amount of data is sent as with FTP) default is 0<br />

❍ optionName=TCP_SLOW_START: Size: 16 bit, sizeof (int) - 1: Enable the TCP slow start algorithm (default), 0:<br />

disabled<br />

❍ optionName=TCP_KEEPALIVE: Size: 16 bit, sizeof (int) - Set idle time seconds before sending keep alive probes.<br />

Default 7200 seconds, minimum 10 seconds, maximum 32767 seconds<br />

Notes:<br />

1. The socket level option SO_KEEPALIVE (see below) must be enabled.<br />

2. The minimum value was changed in <strong>@CHIP</strong>-<strong>RTOS</strong> 070 to 10 seconds (was 7200 seconds in <strong>@CHIP</strong>-<strong>RTOS</strong><br />

Page 165 / 400

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!