www.beck-ipc.com

@CHIP-RTOS C Library V2.00 - BIOS API


BIOS_Connection_Handler

Install a system server connection handler function.

int BIOS_Connection_Handler ( CONN_HANDLER handler,
                              SERVER_SPEC which_server );

Parameters

handler

Vector to callback function

which_server

Enumerator:
    SS_FTP_SERVER = 0, SS_TELNET_SERVER = 1, SS_WEB_SERVER = 2

Return Value

0:  Successf
-1:  Invalid which_server parameter

Comments

A connection handler function must be declared in the following way:

int huge UserConnectionHandler( struct sockaddr_in far *sockptr );

The connection handler will be called if a client establishes a connection to the server (FTP, WEB, Telnet).   The handler could read the IP Address and the port number from the sockaddr_in structure.   The TCP/IP API function InetToAscii might be of use here.

If the connection handler returns zero the connection will be established.   If it returns a non-zero value, the connection will be abort.

Example usage:

    The implemented handler function could check the source IP address (Clients IP), compare this IP with an application internal list of allowed IP addresses and reject the connection by returning a non-zero value if the source IP is not in the list.

A connection handler can be removed by calling BIOS_Connection_Handler with a null pointer.

See Also

RTOS API

This library function invokes a RTOS software interrupt. Refer to this RTOS API function's documentation for more details.


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


End of document