Home |
Diagnostics and Callbacks Recompiling RTIP-32 Driver Source Files |
Diagnostics and CallbacksRTIP-32 can call a number of global callback functions. Pointers to all callbacks are contained in global structure type RTIP_CALLBACKS defined in header file Rtipapi.h. A pointer to this structure is returned by function xn_callbacks: typedef struct rtip_callbacks { CB_CHAP_GET_RANDOM_VALUE_FNC cb_chap_get_random_value_fnc; CB_WR_SCREEN_STRING_FNC cb_wr_screen_string_fnc; CB_RAW_MODE_IN_CHAR_FNC cb_raw_mode_in_char_fnc; CB_RS232_CONNECTION_LOST cb_rs232_connection_lost_fnc; CB_ERROR_REPORT_FNC cb_error_report_fnc; CB_TELNET_INIT_FNC cb_telnet_init_fnc; CB_TELNET_INCHAR_FNC cb_telnet_inchar_fnc; CB_FTP_CHECK_USER_NAME_FNC cb_ftp_check_user_name_fnc; CB_FTP_CHECK_PASSWORD_FNC cb_ftp_check_password_fnc; CB_DHCP_NEW_IP_FNC cb_dhcp_new_ip_fnc; CB_DHCP_NO_IP_FNC cb_dhcp_no_ip_fnc; CB_AUTOIP_NEW_IP_FNC cb_autoip_new_ip_fnc; CB_AUTOIP_NO_IP_FNC cb_autoip_no_ip_fnc; CB_PACKETIN_FILTER_FNC cb_packetin_isr; CB_PACKETIN_FILTER_FNC cb_packetin_task; } RTIP_CALLBACKS; The various callbacks are called on the following events: cb_chap_get_random_value_fncThis function is called by the PPP add-on to retrieve a random number for encryption purposes. The default callback uses run-time system function ran() and initializes the random number generator with srand(GetTickCount()). cb_wr_screen_string_fnccb_wr_screen_string_fnc is called by the stack to display diagnostics and debug messages. The default callback uses OutputDebugString to display such messages on the target or the host. cb_raw_mode_in_char_fncProcesses an RS232 input character on a PPP or SLIP interface while in raw mode. The default callback merely displays the character using RTDisplayChar. cb_rs232_connection_lost_fncCalled when the serial I/O driver detects that a modem has lost the connection during a PPP or SLIP connection. The default callback displays an error message using cb_wr_screen_string_fnc. cb_error_report_fncReports an error message via cb_wr_screen_string_fnc. The default error handler does not display CP_CONNECTION_CLOSING events as they are not considered errors in many applications. cb_telnet_init_fncCalled when the Telnet server receives a new incoming connect. The default callback displays an error message via cb_wr_screen_string_fnc. cb_telnet_inchar_fncCalled when the Telnet server receives a character from a client. The default callback displays an error message via cb_wr_screen_string_fnc and aborts the Telnet session by returning SOCKET_ERROR. Telnet servers must override this callback. cb_ftp_check_user_name_fncCalled by the FTP server to authenticate a user name to log in. The default callback displays an error message via cb_wr_screen_string_fnc and requires a password to be supplied. Note that this callback is used only if the application has not called ftp_server_set_auth. cb_ftp_check_password_fncCalled by the FTP server to authenticate a user's password for logging in. The default callback displays an error message via cb_wr_screen_string_fnc and allows the user to log in. Note that this callback is used only if the application has not called ftp_server_set_auth. cb_dhcp_new_ip_fncCalled by the DHCP Client to announce a new IP address on an interface. cb_dhcp_no_ip_fncCalled by the DHCP Client to announce the loss of an IP address on an interface. Applications can use this callback to be informed when the DHCP server is unable to assign a new IP address and the lease for a previous IP address has expired. cb_autoip_new_ip_fncCalled by the Auto IP code to announce a new IP address on an interface. cb_autoip_no_ip_fncCalled by the Auto IP code to announce the loss of an IP address on an interface. Applications can use this callback to be informed when the auto IP protocol is unable to assign a new IP address and the previous IP address has been allocated by another host. cb_packetin_isrCalled by the Ethernet driver's hardware interrupt handler when a data packet has been received. Applications can inspect the data, modify it, or discard it. cb_packetin_taskCalled in the context of the IP task just before an incoming packet data will be processed. Applications can inspect the data, modify it, or discard it. By default, RTIP-32 supplies functions for cb_wr_screen_string_fnc and cb_error_report_fnc to call OutputDebugString. RTTarget-32 function RTSetFlags can be used to control where such messages are displayed. All other callbacks are set to NULL (i.e. they do not get called by default). To supply your own callback, assign a suitable function pointer to rtip_callbacks->.
|