www.beck-ipc.com

@CHIP-RTOS C Library - TCP/IP API


getsockopt_bsd

Get socket option.

int far getsockopt_bsd ( int sd,
                         int protocol_level,
                         int optionName,
                         char far * optionValue,
                         int far * optionLengthPtr ) ;

Parameters

sd

Socket descriptor

protocol_level

One of following constants:
    IP_PROTOIP_LEVEL
    IP_PROTOTCP_LEVEL
    SOCKET_LEVEL

optionName

Option's name constant.

optionValue

Output Parameter:   Option value is reported here (type varies).

optionLengthPtr

Input/Output Parameter:   Caller sets this referenced integer to the number of bytes space available in buffer referenced by optionValue parameter.   On success, this API then sets this same integer to the size in bytes of the reported option.

Return Value

0 on success
-1: Failure, error code is available using get_socketerror.

Comments

On success, this function reports the requested socket option value to the buffer pointed to by the optionValue parameter and the length of this reported value is written to the location pointed to by the optionLengthPtr parameter.

The optionValue parameter must point to a sufficiently large buffer to receive the reported option value and the size of this buffer must be stated in the location referenced by the optionLengthPtr parameter.   Note that this length specifier is both an input and an output parameter for this function.   If on entry, the location referenced by optionLengthPtr contains a value less than the buffer space required to report the requested socket option value, then the function will fail with socket error code 242.

The socket options of an incoming connection (using either accept_bsd() or accept()) will be the same as the socket options of the listening socket.

If the compilation switch

     #define BSD44_SOCKET_API_STYLE

is set as a global define in the user application prior to including the Beck C-library header files, the getsockopt() call can be used in BSD 4.4 compatible style with the parameters specified above.   Using this switch the CLIB TCPIP_Socket.H redefines getsockopt() to getsockopt_bsd() .

See Also

RTOS API

On the first call, this library function invokes a software interrupt which modifies the code at the calling site inside your application program.   A direct FAR JMP into the @CHIP-RTOS-x86 implementation for this function is installed so that on return and on any subsequent calls to this API this dynamic link reaches the function's implementation directly.

Supported since or modified in @CHIP-RTOS version

    SC12SC13SC11SC1x3SC2x
    n/an/an/aV1.36V1.36

Supported by @CHIP-RTOS C Library since version

    CLIB
    V2.20

This API List
List of C Libraries
@CHIP-RTOS Main Index


End of document