/******************************************************************************* ** Riverstone Networks, Inc ** 5200 Great America Parkway ** Santa Clara CA 95054 ** (c) Copyright Riverstone Networks 2000 ** ** Original Author: Todd Crowley ** *******************************************************************************/ /******************************************************************************/ /* */ /* File: LfapCCEos_h */ /* */ /* This file is an example (template) header file for the CCE. These */ /* functions must be implemented by the CCE developers. The comments before */ /* the functions describe them in detail. */ /* */ /******************************************************************************/ #ifndef LFAPCCEOS_H_ #define LFAPCCEOS_H_ #include "LfapStruct.h" #ifdef __cplusplus extern "C" { #endif /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPGetUptime - return the CCE uptime value in hundredths of seconds */ /* */ /* SYNOPSIS */ /* */ /* lfapui32_t LFAPGetUptime (void) */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to get the CCE uptime value. */ /* The uptime returned is of type SNMPv2 TimeStamp (RFC 1443), therefore */ /* it is the length of time in hundredths of seconds that the CCE has */ /* been operational. */ /* */ /* RETURN */ /* */ /* Unsigned long value indicating the CCE uptime in hundredths of seconds. */ /* */ /* CAVEATS */ /* */ /* This function should be autonomous (no context switches if on a */ /* threaded operating system). */ /* */ /******************************************************************************/ lfapui32_t LFAPGetUptime (void); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPGetStatistics - get the statistics for a flow */ /* */ /* SYNOPSIS */ /* */ /* void LFAPGetStatistics (lfapui32_t flow_id, LFAPFlowStats* flow_stats) */ /* */ /* flow_id - lfapui32_t indicating the identifier for the flow. */ /* */ /* flow_stats - pointer to a zero initialized LFAPFlowStats */ /* structure (see LfapStruct.h for a description) to be */ /* filled in by this function. */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to get the statistics on a flow */ /* with identifier flow_id. A pointer to a zero initialized LFAPFlowStats */ /* structure is passed in to be filled in by this function. */ /* */ /* RETURN */ /* */ /* Nothing. */ /* */ /* CAVEATS */ /* */ /* This function should be autonomous (no context switches if on a */ /* threaded operating system). */ /* */ /******************************************************************************/ void LFAPGetStatistics (lfapui32_t flow_id, LFAPFlowStats* flow_stats); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPSynchronize - allow the CCE to run other tasks */ /* */ /* SYNOPSIS */ /* */ /* void LFAPSynchronize (void) */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to allow a non-preemptive */ /* system to run other tasks. The CCE should complete whatever work it */ /* wishes to complete, then return from this function. Returning from */ /* this function will allow the LFAP API to continue with its work. This */ /* function should (at a minimum) allow a context switch to occur. */ /* */ /* RETURN */ /* */ /* Nothing. */ /* */ /* CAVEATS */ /* */ /* None. */ /* */ /******************************************************************************/ void LFAPSynchronize (void); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPSetSystemTimer - set a one-shot timer */ /* */ /* SYNOPSIS */ /* */ /* void LFAPSetSystemTimer (const LFAP_CB_ENTRYPOINT lfap_cb_entry, */ /* lfapui32_t return_handle, */ /* lfapui32_t time_val) */ /* */ /* lfap_cb_entry - callback entrypoint to be called back when the */ /* timer expires. */ /* */ /* return_handle - argument the lfap_cb_entry should be called back */ /* with. */ /* */ /* time_val - lfapui32_t value indicating the time to wait (in */ /* milliseconds) before the lfap_cb_entry should be */ /* called back. */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to set a timer for time_val */ /* milliseconds. lfap_cb_entry is the callback entrypoint that is called */ /* with the parameter return_handle upon completion of the timer. */ /* */ /* RETURN */ /* */ /* Nothing. */ /* */ /* CAVEATS */ /* */ /* More than one timer can be outstanding at one time. */ /* */ /******************************************************************************/ void LFAPSetSystemTimer (const LFAP_CB_ENTRYPOINT lfap_cb_entry, lfapui32_t return_handle, lfapui32_t time_val); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPSendMessage - send a message to the server on the TCP connection */ /* */ /* SYNOPSIS */ /* */ /* int LFAPSendMessage (void* buf, lfapui16_t buf_len) */ /* */ /* buf - pointer to an encoded message allocated on the heap, to be */ /* sent to the server. */ /* */ /* buf_len - length of the encoded message. */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to send the (void*) buf to the */ /* server. buf_len includes the length of the header of the LFAP message. */ /* */ /* RETURN */ /* */ /* Integer indicating if the send was successful. If successful, */ /* LFAP_SEND_SUCCESS is returned, else LFAP_SEND_FAILURE is returned. */ /* */ /* CAVEATS */ /* */ /* None. */ /* */ /******************************************************************************/ int LFAPSendMessage (void* buf, lfapui16_t buf_len); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPSendVector - send an array of messages to the server */ /* */ /* SYNOPSIS */ /* */ /* int LFAPSendVector (LFAPMsgHolder* vec, */ /* lfapui16_t vec_len, */ /* lfapui16_t total_len) */ /* */ /* vec - pointer to an array of LFAPMsgHolder structures, each of */ /* which has an encoded message allocated on the heap, to be */ /* sent to the server. */ /* */ /* vec_len - number of LFAPMsgHolders in the array */ /* */ /* total_len - total number of bytes of the messages in the array */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to send the messages in the */ /* LFAPMsgHolder array to the server. */ /* */ /* RETURN */ /* */ /* Integer indicating if the send was successful. If successful, */ /* LFAP_SEND_SUCCESS is returned, else LFAP_SEND_FAILURE is returned. */ /* */ /* CAVEATS */ /* */ /* None. */ /* */ /******************************************************************************/ int LFAPSendVector (LFAPMsgHolder* vec, lfapui16_t vec_len, lfapui16_t total_len); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPConnect - attempt to make a TCP connection to a server */ /* */ /* SYNOPSIS */ /* */ /* int LFAPConnect (lfapui32_t server_ip) */ /* */ /* server_ip - lfapui32_t form of the server's IP address that */ /* the CCE should attempt to make a TCP connection to. */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to attempt to make a TCP */ /* connection to the server specified by server_ip. The server is */ /* listening on the LFAP_PORT. */ /* */ /* RETURN */ /* */ /* Integer indicating if the TCP connection was created. If the */ /* connection was created, LFAP_TCP_CONNECTION_ESTABLISHED is returned, */ /* else LFAP_TCP_CONNECTION_FAILED is returned. */ /* */ /* CAVEATS */ /* */ /* None. */ /* */ /******************************************************************************/ int LFAPConnect (lfapui32_t server_ip); /******************************************************************************/ /* */ /* FUNCTION */ /* */ /* LFAPDisconnect - attempt to break the TCP connection to a server */ /* */ /* SYNOPSIS */ /* */ /* int LFAPDisconnect (lfapui32_t server_ip) */ /* */ /* server_ip - lfapui32_t form of the server's IP address that */ /* the CCE should attempt to break the TCP connection */ /* with. */ /* */ /* DESCRIPTION */ /* */ /* This function is called by the LFAP API to attempt to break the TCP */ /* connection to a server specified by server_ip. */ /* */ /* RETURN */ /* */ /* Integer indicating if the TCP connection was broken. If the */ /* connection was broken, LFAP_TCP_DISCONNECT_SUCCESS is returned, else */ /* LFAP_TCP_DISCONNECT_FAILED is returned. */ /* */ /* CAVEATS */ /* */ /* None. */ /* */ /******************************************************************************/ int LFAPDisconnect (lfapui32_t server_ip); #ifdef __cplusplus } #endif #endif /* LFAPCCEOS_H_ */