michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef _PLAT_API_H_ michael@0: #define _PLAT_API_H_ michael@0: michael@0: #include "cc_constants.h" michael@0: #include "cpr_socket.h" michael@0: #include "cc_types.h" michael@0: michael@0: /** michael@0: * Define unregister reason michael@0: */ michael@0: #define CC_UNREG_REASON_UNSPECIFIED 0 michael@0: //Common with what SCCP uses...need to match with J-Side michael@0: #define CC_UNREG_REASON_TCP_TIMEOUT 10 michael@0: #define CC_UNREG_REASON_CM_RESET_TCP 12 michael@0: #define CC_UNREG_REASON_CM_ABORTED_TCP 13 michael@0: #define CC_UNREG_REASON_CM_CLOSED_TCP 14 michael@0: #define CC_UNREG_REASON_REG_TIMEOUT 17 michael@0: #define CC_UNREG_REASON_FALLBACK 18 michael@0: #define CC_UNREG_REASON_PHONE_KEYPAD 20 michael@0: #define CC_UNREG_REASON_RESET_RESET 22 michael@0: #define CC_UNREG_REASON_RESET_RESTART 23 michael@0: #define CC_UNREG_REASON_PHONE_REG_REJ 24 michael@0: #define CC_UNREG_REASON_PHONE_INITIALIZED 25 michael@0: #define CC_UNREG_REASON_VOICE_VLAN_CHANGED 26 michael@0: #define CC_UNREG_REASON_POWER_SAVE_PLUS 32 michael@0: //sip specific ones...need to match with J-Side michael@0: #define CC_UNREG_REASON_VERSION_STAMP_MISMATCH 100 michael@0: #define CC_UNREG_REASON_VERSION_STAMP_MISMATCH_CONFIG 101 michael@0: #define CC_UNREG_REASON_VERSION_STAMP_MISMATCH_SOFTKEY 102 michael@0: #define CC_UNREG_REASON_VERSION_STAMP_MISMATCH_DIALPLAN 103 michael@0: #define CC_UNREG_REASON_APPLY_CONFIG_RESTART 104 michael@0: #define CC_UNREG_REASON_CONFIG_RETRY_RESTART 105 michael@0: #define CC_UNREG_REASON_TLS_ERROR 106 michael@0: #define CC_UNREG_REASON_RESET_TO_INACTIVE_PARTITION 107 michael@0: #define CC_UNREG_REASON_VPN_CONNECTIVITY_LOST 108 michael@0: michael@0: #define CC_IPPROTO_UDP 17 michael@0: #define CC_IPPROTO_TCP 6 michael@0: michael@0: michael@0: /** michael@0: * socket security status michael@0: */ michael@0: typedef enum michael@0: { michael@0: PLAT_SOCK_SECURE, michael@0: PLAT_SOCK_NONSECURE michael@0: } plat_soc_status_e; michael@0: michael@0: /** michael@0: * socket connection status michael@0: */ michael@0: typedef enum michael@0: { michael@0: PLAT_SOCK_CONN_OK, michael@0: PLAT_SOCK_CONN_WAITING, michael@0: PLAT_SOCK_CONN_FAILED michael@0: } plat_soc_connect_status_e; michael@0: michael@0: /** michael@0: * socket connection type michael@0: */ michael@0: typedef enum michael@0: { michael@0: PLAT_SOCK_CUCM michael@0: } plat_soc_connect_type_e; michael@0: michael@0: /** michael@0: * socket connection mode michael@0: */ michael@0: typedef enum michael@0: { michael@0: PLAT_SOCK_AUTHENTICATED, michael@0: PLAT_SOCK_ENCRYPTED, michael@0: PLAT_SOCK_NON_SECURE michael@0: } plat_soc_connect_mode_e; michael@0: michael@0: /** michael@0: * psipcc core debug categories michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_CCAPP, michael@0: CC_DEBUG_CONFIG_CACHE, michael@0: CC_DEBUG_SIP_ADAPTER, michael@0: CC_DEBUG_CCAPI, michael@0: CC_DEBUG_CC_MSG, michael@0: CC_DEBUG_FIM, michael@0: CC_DEBUG_FSM, michael@0: CC_DEBUG_AUTH, michael@0: CC_DEBUG_GSM, michael@0: CC_DEBUG_LSM, michael@0: CC_DEBUG_FSM_CAC, michael@0: CC_DEBUG_DCSM, michael@0: CC_DEBUG_SIP_TASK, michael@0: CC_DEBUG_SIP_STATE, michael@0: CC_DEBUG_SIP_MSG, michael@0: CC_DEBUG_SIP_REG_STATE, michael@0: CC_DEBUG_SIP_TRX, michael@0: CC_DEBUG_TIMERS, michael@0: CC_DEBUG_SIP_DM, michael@0: CC_DEBUG_CCDEFAULT, /* Always ON by default */ michael@0: CC_DEBUG_DIALPLAN, michael@0: CC_DEBUG_KPML, michael@0: CC_DEBUG_REMOTE_CC, michael@0: CC_DEBUG_SIP_PRESENCE, michael@0: CC_DEBUG_CONFIG_APP, michael@0: CC_DEBUG_CALL_EVENT, michael@0: CC_DEBUG_PLAT, michael@0: CC_DEBUG_NOTIFY, michael@0: CC_DEBUG_CPR_MEMORY, /* Has additional parameters - Tracking/poison */ michael@0: CC_DEBUG_MAX /* NOT USED */ michael@0: } cc_debug_category_e; michael@0: michael@0: michael@0: /** michael@0: * debug show categories michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_SHOW_FSMCNF, michael@0: CC_DEBUG_SHOW_FSMDEF, michael@0: CC_DEBUG_SHOW_FSMXFR, michael@0: CC_DEBUG_SHOW_FSMB2BCNF, michael@0: CC_DEBUG_SHOW_DCSM, michael@0: CC_DEBUG_SHOW_FIM, michael@0: CC_DEBUG_SHOW_FSM, michael@0: CC_DEBUG_SHOW_LSM, michael@0: CC_DEBUG_SHOW_BULK_REGISTER, michael@0: CC_DEBUG_SHOW_KPML, michael@0: CC_DEBUG_SHOW_REMOTE_CC, michael@0: CC_DEBUG_SHOW_CONFIG_CACHE, michael@0: CC_DEBUG_SHOW_SUBS_STATS, michael@0: CC_DEBUG_SHOW_PUBLISH_STATS, michael@0: CC_DEBUG_SHOW_REGISTER, michael@0: CC_DEBUG_SHOW_DIALPLAN, michael@0: CC_DEBUG_SHOW_CPR_MEMORY, /* Has additional parameters - michael@0: config/heap-gaurd/stat/tracking. */ michael@0: CC_DEBUG_SHOW_MAX michael@0: } cc_debug_show_options_e; michael@0: michael@0: /** michael@0: * debug clear categories michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_CLEAR_CPR_MEMORY, michael@0: CC_DEBUG_CLEAR_MAX michael@0: } cc_debug_clear_options_e; michael@0: michael@0: /** michael@0: * cpr memory debug sub-categories michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_CPR_MEM_TRACKING, michael@0: CC_DEBUG_CPR_MEM_POISON michael@0: } cc_debug_cpr_mem_options_e; michael@0: michael@0: /** michael@0: * cpr memory clear sub-commands michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_CLEAR_CPR_TRACKING, michael@0: CC_DEBUG_CLEAR_CPR_STATISTICS michael@0: } cc_debug_clear_cpr_options_e; michael@0: michael@0: /** michael@0: * cpr memory show sub-commands michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_SHOW_CPR_CONFIG, michael@0: CC_DEBUG_SHOW_CPR_HEAP_GUARD, michael@0: CC_DEBUG_SHOW_CPR_STATISTICS, michael@0: CC_DEBUG_SHOW_CPR_TRACKING michael@0: } cc_debug_show_cpr_options_e; michael@0: michael@0: /** michael@0: * Enabling/disabling debugs michael@0: */ michael@0: typedef enum michael@0: { michael@0: CC_DEBUG_DISABLE, michael@0: CC_DEBUG_ENABLE michael@0: } cc_debug_flag_e; michael@0: michael@0: // Corresponds to the values for XML tags DHCPv4Status and DHCPv6Status michael@0: typedef enum { michael@0: DHCP_STATUS_GOOD = 1, michael@0: DHCP_STATUS_TIMEOUT, michael@0: DHCP_STATUS_DISABLED michael@0: } dhcp_status_e; michael@0: michael@0: michael@0: // Corresponds to the value for XML tag for DNSStatusUnifiedCMX michael@0: typedef enum { michael@0: DNS_STATUS_GOOD = 1, michael@0: DNS_STATUS_TIMEOUT, michael@0: DNS_STATUS_DID_NOT_RESOLVE, michael@0: DNS_STATUS_NA_IP_CONFIGURED michael@0: } ucm_dns_resolution_status_e; michael@0: michael@0: #define LEN32 32 michael@0: #define IP_ADDR_MAX_LEN 32 michael@0: #define PORT_MAX_LEN 20 michael@0: #define STATUS_MAX_LEN 4 michael@0: #define LEN80 80 michael@0: #define WIRED_PROP_PREFIX "dhcp.eth0" michael@0: #define WIRELESS_PROP_PREFIX "dhcp.mlan0" michael@0: #define WIRED_INT 1 michael@0: #define WIFI_INT 2 michael@0: michael@0: michael@0: /** michael@0: * Called by the thread to initialize any thread specific data michael@0: * once the thread is created. michael@0: * michael@0: * @param[in] tname thread name michael@0: * michael@0: * @return 0 - SUCCESS michael@0: * -1 - FAILURE michael@0: */ michael@0: int platThreadInit(char * tname); michael@0: michael@0: /** michael@0: * The initial initialization function for any platform related michael@0: * modules michael@0: * michael@0: * michael@0: * @return 0 - SUCCESS michael@0: * -1 - FAILURE michael@0: */ michael@0: int platInit(); michael@0: michael@0: /** michael@0: * The initial initialization function for the debugging/logging michael@0: * modules michael@0: * michael@0: */ michael@0: void debugInit(); michael@0: michael@0: /** michael@0: * Get device model that will be sent to cucm in the UserAgent header michael@0: * michael@0: * @return char * Pointer to the string containing the model number of the phone. michael@0: */ michael@0: char *platGetModel(); michael@0: michael@0: /** michael@0: * plat_audio_device_t michael@0: * Enums for indicating audio device michael@0: */ michael@0: typedef enum vcm_audio_device_type { michael@0: VCM_AUDIO_DEVICE_NONE, michael@0: VCM_AUDIO_DEVICE_HEADSET, michael@0: VCM_AUDIO_DEVICE_SPEAKER michael@0: } plat_audio_device_t; michael@0: michael@0: michael@0: /** michael@0: * Add cc control classifier michael@0: * michael@0: * Called by SIP stack to specify addresses and ports that will be used for call control michael@0: * michael@0: * @param[in] myIPAddr - phone local interface IP Address michael@0: * @param[in] myPort - phone local interface Port michael@0: * @param[in] cucm1IPAddr - CUCM 1 IP Address michael@0: * @param[in] cucm1Port - CUCM 1 Port michael@0: * @param[in] cucm2IPAddr - CUCM 2 IP Address michael@0: * @param[in] cucm2Port - CUCM 2 Port michael@0: * @param[in] cucm3IPAddr - CUCM 3 IP Address michael@0: * @param[in] cucm3Port - CUCM 3 Port michael@0: * @param[in] protocol - CC_IPPROTO_UDP or CC_IP_PROTO_TCP michael@0: * michael@0: * @note : Needed only if using WiFi. If not using Wifi please provide a stub michael@0: */ michael@0: void platAddCallControlClassifiers(unsigned long myIPAddr, unsigned short myPort, michael@0: unsigned long cucm1IPAddr, unsigned short cucm1Port, michael@0: unsigned long cucm2IPAddr, unsigned short cucm2Port, michael@0: unsigned long cucm3IPAddr, unsigned short cucm3Port, michael@0: unsigned char protocol); michael@0: michael@0: /** michael@0: * Remove cc control classifier. michael@0: * michael@0: * Undo platAddCallControlClassifiers michael@0: */ michael@0: void platRemoveCallControlClassifiers(); michael@0: michael@0: /** michael@0: * Tell whether wifi is supported and active michael@0: * michael@0: * @return boolean wether WLAN is active or not michael@0: */ michael@0: cc_boolean platWlanISActive(); michael@0: michael@0: /** michael@0: * Check if the netowrk interface changed. michael@0: * michael@0: * @return boolean returns TRUE if the network interface has changed michael@0: * michael@0: * @note Most common case is for softphone clients where if a PC is michael@0: * undocked the network interface changes from wired to wireless. michael@0: */ michael@0: boolean platIsNetworkInterfaceChanged(); michael@0: michael@0: /** michael@0: * Get active phone load name michael@0: * michael@0: * Returns the phone images in the active and inactive partitions michael@0: * The phone reports these phone loads to CUCM for display on the Admin page michael@0: * michael@0: * @param[in] image_a : Populate the image name from partition a michael@0: * @param[in] image_b : Populate the image name from partition b michael@0: * @param[in] len : Length of the pointers for image_a and image_b michael@0: * @return 1 - image_a is active michael@0: * 2 - image_b is active michael@0: * -1 - Failure michael@0: */ michael@0: int platGetActiveInactivePhoneLoadName(char * image_a, char * image_b, int len); michael@0: michael@0: /** michael@0: * Get localized phrase for the specified index michael@0: * michael@0: * @param[in] index the phrase index, see michael@0: * @param[in] phrase the return phrase holder michael@0: * @param[in] len the input length to cap the maximum value michael@0: * michael@0: * @return SUCCESS or FAILURE michael@0: */ michael@0: int platGetPhraseText(int index, char* phrase, unsigned int len); michael@0: michael@0: /** michael@0: * Set the unregistration reason michael@0: * michael@0: * @param[in] reason see the unregister reason definitions. michael@0: * michael@0: * @note we expect the platform to save this value in Non Volatile memory michael@0: * This will be retrieved later by using platGetUnregReason. This reason is reported to CUCM michael@0: */ michael@0: void platSetUnregReason(int reason); michael@0: michael@0: michael@0: /** michael@0: * Get the unregistration reason code. michael@0: * michael@0: * @return reason code for unregistration michael@0: */ michael@0: int platGetUnregReason(); michael@0: michael@0: /** michael@0: * Sets the time based on Date header in 200 OK from REGISTER request michael@0: * @param void michael@0: * @return void michael@0: */ michael@0: void platSetCucmRegTime (void); michael@0: michael@0: /** michael@0: * Set the kpml value for application. michael@0: * michael@0: * @param kpml_config the kpml value michael@0: */ michael@0: void platSetKPMLConfig(cc_kpml_config_t kpml_config); michael@0: michael@0: /** michael@0: * Check if a line has active MWI status michael@0: * michael@0: * @param line michael@0: * michael@0: * @return boolean michael@0: * michael@0: * @note The stack doesn't store the MWI status and expects michael@0: * the application to store that information. The stack michael@0: * queries the mwi status from the application using this method. michael@0: */ michael@0: boolean platGetMWIStatus(cc_lineid_t line); michael@0: michael@0: /** michael@0: * Check if the speaker or headset is enabled. michael@0: * michael@0: * @return boolean if the speaker or headset is enabled, returns true. michael@0: */ michael@0: boolean platGetSpeakerHeadsetMode(); michael@0: michael@0: /** michael@0: * Secure Socket API's. michael@0: * The pSIPCC expects the following Secure Socket APIs to be implemented in the michael@0: * vendor porting layer. michael@0: */ michael@0: michael@0: /** michael@0: * platSecIsServerSecure michael@0: * michael@0: * @brief Lookup the secure status of the server michael@0: * michael@0: * This function looks at the the CCM server type by using the security library michael@0: * and returns appropriate indication to the pSIPCC. michael@0: * michael@0: * michael@0: * @return Server is security enabled or not michael@0: * PLAT_SOCK_SECURE or PLAT_SOCK_NONSECURE michael@0: * michael@0: * @note This API maps to the following HandyIron API: michael@0: * int secIsServerSecure(SecServerType type) where type should be SRVR_TYPE_CCM michael@0: */ michael@0: plat_soc_status_e platSecIsServerSecure(void); michael@0: michael@0: michael@0: /** michael@0: * platSecSocConnect michael@0: * @brief Securely connect to a remote server michael@0: * michael@0: * This function uses the security library APIs to connect to a remote server. michael@0: * @param[in] host server addr michael@0: * @param[in] port port number michael@0: * @param[in] ipMode IP mode to indicate v6, v4 or both michael@0: * @param[in] mode blocking connect or not michael@0: * FALSE: non-blocking; TRUE: blocking michael@0: * @param[in] tos TOS value michael@0: * @param[in] connectionMode The mode of the connection michael@0: * (Authenticated/Encrypted) michael@0: * @param[out] localPort local port used for the connection michael@0: * michael@0: * @return client socket descriptor michael@0: * >=0: connected or in progress michael@0: * INVALID SOCKET: failed michael@0: * michael@0: * @pre (hostAndPort not_eq NULL) michael@0: * @pre (localPort not_eq NULL) michael@0: * michael@0: * @note localPort is undefined when the return value is INVALID_SOCKET michael@0: * michael@0: * @note This API maps to the HandyIron APIs as follows: michael@0: * If mode == TRUE (blocking): michael@0: * int secEstablishSecureConnection(const char* serverAddr, *uint32_t port, secConnectionType type) michael@0: * @li ipMode is UNUSED michael@0: * @li "host" maps to "serverAddr", "type" should be determined by an application and use the value from SecServerType. michael@0: * @li localPort is passed in as 0 michael@0: * If mode == FALSE (non-blocking): michael@0: * int secConnect(const char* serverAddr, uint32_t port, *secConnectionType type, uint32_t localPort) michael@0: * @li ipMode is UNUSED michael@0: * @li "host" maps to "serverAddr", "type" should be determined by an application and use the value from SecServerType. michael@0: * michael@0: * @note The implementation should use the "setsockopt" to set the "tos" value passed michael@0: * in this API on the created socket. michael@0: * michael@0: */ michael@0: cpr_socket_t michael@0: platSecSocConnect (char *host, michael@0: int port, michael@0: int ipMode, michael@0: boolean mode, michael@0: unsigned int tos, michael@0: plat_soc_connect_mode_e connectionMode, michael@0: cc_uint16_t *localPort); michael@0: michael@0: /** michael@0: * platSecSockIsConnected michael@0: * Determine the status of a secure connection that was initiated michael@0: * in non-blocking mode michael@0: * michael@0: * @param[in] sock socket descriptor michael@0: * michael@0: * @return connection status michael@0: * @li connection complete: PLAT_SOCK_CONN_OK michael@0: * @li connection waiting: PLAT_SOCK_CONN_WAITING michael@0: * @li connection failed: PLAT_SOCK_CONN_FAILED michael@0: * michael@0: * @note This API maps to the following HandyIron API: michael@0: * int secIsConnectionReady (int connDesc) michael@0: * The "sock" is the connection descriptor. michael@0: */ michael@0: plat_soc_connect_status_e platSecSockIsConnected (cpr_socket_t sock); michael@0: michael@0: /** michael@0: * platGenerateCryptoRand michael@0: * @brief Generates a Random Number michael@0: * michael@0: * Generate crypto graphically random number for a desired length. michael@0: * The function is expected to be much slower than the cpr_rand(). michael@0: * This function should be used when good random number is needed michael@0: * such as random number that to be used for SRTP key for an example. michael@0: * michael@0: * @param[in] buf - pointer to the buffer to store the result of random michael@0: * bytes requested. michael@0: * @param[in] len - pointer to the length of the desired random bytes. michael@0: * When calling the function, the integer's value michael@0: * should be set to the desired number of random michael@0: * bytes ('buf' should be of at least this size). michael@0: * upon success, its value will be set to the michael@0: * actual number of random bytes being returned. michael@0: * (realistically, there is a maximum number of michael@0: * random bytes that can be returned at a time. michael@0: * if the caller request more than that, the michael@0: * 'len' will indicate how many bytes are actually being michael@0: * returned) on failure, its value will be set to 0. michael@0: * michael@0: * @return michael@0: * 1 - success. michael@0: * 0 - fail. michael@0: * michael@0: * @note The intent of this function is to generate a cryptographically strong michael@0: * random number. Vendors can map this to HandyIron or OpenSSL random number michael@0: * generation functions. michael@0: * michael@0: * @note This API maps to the following HandyIron API: michael@0: * int secGetRandomData(uint8_t *buf, uint32_t size). Also note that a michael@0: * "secAddEntropy(...)" may be required the first time to feed entropy data to michael@0: * the random number generator. michael@0: */ michael@0: int platGenerateCryptoRand(cc_uint8_t *buf, int *len); michael@0: michael@0: /** michael@0: * platSecSocSend michael@0: * michael@0: * @brief The platSecSocSend() function is used to send data over a secure michael@0: * socket. michael@0: * michael@0: * The platSecSocSend() function shall transmit a message from the specified socket to michael@0: * its peer. The platSecSocSend() function shall send a message only when the socket is michael@0: * connected. The length of the message to be sent is specified by the length michael@0: * argument. If the message is too long to pass through the underlying protocol, michael@0: * platSecSocSend() shall fail and no data is transmitted. Delivery of the message is michael@0: * not guaranteed. michael@0: * michael@0: * @param[in] soc Specifies the socket created with cprSocket() to send michael@0: * @param[in] buf A pointer to the buffer of the message to send. michael@0: * @param[in] len Specifies the length in bytes of the message pointed to by the buffer argument. michael@0: * michael@0: * @return Upon successful completion, platSecSocSend() shall return the number of michael@0: * bytes sent. Otherwise, SOCKET_ERROR shall be returned and cpr_errno set to michael@0: * indicate the error. michael@0: * michael@0: * @note The possible error values this function should return are michael@0: * @li [CPR_EBADF] The socket argument is not a valid file descriptor michael@0: * @li [CPR_ENOTSOCK] socket does not refer to a socket descriptor michael@0: * @li [CPR_EAGAIN] The socket is marked non-blocking and no data can michael@0: * be sent michael@0: * @li [CPR_EWOULDBLOCK] Same as CPR_EAGAIN michael@0: * @li [CPR_ENOTCONN] A connection-mode socket that is not connected michael@0: * @li [CPR_ENOTSUPP] The specified flags are not supported for this michael@0: * type of socket or protocol. michael@0: * @li [CPR_EMSGSIZE] The message is too large to be sent all at once michael@0: * @li [CPR_EDESTADDRREQ] The socket has no peer address set michael@0: * michael@0: */ michael@0: ssize_t michael@0: platSecSocSend (cpr_socket_t soc, michael@0: CONST void *buf, michael@0: size_t len); michael@0: michael@0: /** michael@0: * platSecSocRecv michael@0: * michael@0: * @brief The platSecSocRecv() function shall receive a message from a secure socket. michael@0: * michael@0: * This function is normally used with connected sockets because it does not permit michael@0: * the application to retrieve the source address of received data. The michael@0: * platSecSocRecv() function shall return the length of the message written to michael@0: * the buffer pointed to by the "buf" argument. michael@0: * michael@0: * @param[in] soc - Specifies the socket to receive data michael@0: * @param[out] buf - Contains the data received michael@0: * @param[out] len - The length of the data received michael@0: * michael@0: * @return On success the length of the message in bytes (including zero). michael@0: * On failure SOCKET_ERROR shall be returned and cpr_errno set to michael@0: * indicate the error. michael@0: * michael@0: * @note The possible error values this function should return are michael@0: * @li [CPR_EBADF] The socket argument is not a valid file descriptor michael@0: * @li [CPR_ENOTSOCK] The descriptor references a file, not a socket. michael@0: * @li [CPR_EAGAIN] The socket is marked non-blocking and no data is michael@0: * waiting to be received. michael@0: * @li [CPR_EWOULDBLOCK] Same as CPR_EAGAIN michael@0: * @li [CPR_ENOTCONN] A receive attempt is made on a connection-mode socket that is not connected michael@0: * @li [CPR_ENOTSUPP] The specified flags are not supported for this type of socket or protocol michael@0: * michael@0: */ michael@0: ssize_t michael@0: platSecSocRecv (cpr_socket_t soc, michael@0: void * RESTRICT buf, michael@0: size_t len); michael@0: michael@0: /** michael@0: * platSecSocClose michael@0: * michael@0: * @brief The platSecSocClose function shall close a secure socket michael@0: * michael@0: * The platSecSocClose() function shall destroy the socket descriptor indicated michael@0: * by socket. michael@0: * michael@0: * @param[in] soc - The socket that needs to be destroyed michael@0: * michael@0: * @return CPR_SUCCESS on success otherwise, CPR_FAILURE. cpr_errno needs to be set in this case. michael@0: * michael@0: * @note The possible error values this function should return are michael@0: * @li [CPR_EBADF] socket is not a valid socket descriptor. michael@0: */ michael@0: cpr_status_e michael@0: platSecSocClose (cpr_socket_t soc); michael@0: michael@0: /** michael@0: * Sets the SIS protocol version michael@0: * michael@0: * @param a - major version michael@0: * @param b - minor version michael@0: * @param c - additional version information michael@0: * @param name - version name michael@0: * michael@0: * @return void michael@0: * @note the platform should store this information and provide it when asked via the platGetSISProtocolVer() michael@0: */ michael@0: michael@0: void platSetSISProtocolVer(cc_uint32_t a, cc_uint32_t b, cc_uint32_t c, char* name); michael@0: michael@0: /** michael@0: * Provides the SIS protocol version michael@0: * michael@0: * @param *a pointer to fill in the major version michael@0: * @param *b pointer to fill in the minor version michael@0: * @param *c pointer to fill in the additonal version michael@0: * @param *name pointer to fill in the version name michael@0: * michael@0: * @return void michael@0: */ michael@0: void michael@0: platGetSISProtocolVer (cc_uint32_t *a, cc_uint32_t *b, cc_uint32_t *c, char* name); michael@0: michael@0: /** michael@0: * Provides the local IP address michael@0: * michael@0: * @return char * returns the local IP address michael@0: */ michael@0: char *platGetIPAddr(); michael@0: michael@0: /** michael@0: * Provides the local MAC address michael@0: * michael@0: * @param *maddr the pointer to the string holding MAC address michael@0: * in the MAC address format after converting from string format. michael@0: * @return void michael@0: */ michael@0: void platGetMacAddr(char *addr); michael@0: michael@0: michael@0: /** michael@0: * platGetFeatureAllowed michael@0: * michael@0: * Get whether the feature is allowed michael@0: * michael@0: * @param featureId - sis feature id michael@0: * michael@0: * @return 1 - allowed, 0 - not allowed michael@0: * michael@0: */ michael@0: int platGetFeatureAllowed(cc_sis_feature_id_e featureId); michael@0: michael@0: michael@0: /** michael@0: * Set the Status message for failure reasons michael@0: * @param char *msg michael@0: * @return void michael@0: */ michael@0: void platSetStatusMessage(char *msg); michael@0: michael@0: /** michael@0: * The equivalent of the printf function. michael@0: * michael@0: * This function MUST be implemented by the vendors. This is called by the core michael@0: * library whenever some debugging information needs to be printed out. michael@0: * call this function in order to clear the CPR Memory/Tracking statistics michael@0: * michael@0: * Please also be aware that cpr_stdio.h has other logging functions as well. michael@0: * Vendors need to implement this function and the functions (err_msg, michael@0: * buginf....etc) found in cpr_stdio.h michael@0: * michael@0: * @param[in] _format format string michael@0: * @param[in] ... variable arg list michael@0: * michael@0: * @return Return code from printf michael@0: */ michael@0: int debugif_printf(const char *_format, ...); michael@0: michael@0: /** michael@0: * Enable / disable speaker michael@0: * michael@0: * @param[in] state - true -> enable speaker, false -> disable speaker michael@0: * michael@0: * @return void michael@0: */ michael@0: michael@0: void platSetSpeakerMode(cc_boolean state); michael@0: michael@0: /** michael@0: * Get the status (on/off) of the audio device michael@0: * michael@0: * @param[in] device_type - headset or speaker (see vcm_audio_device_t) michael@0: * michael@0: * @return 1 -> On, 0 -> off, ERROR -> unknown (error) michael@0: */ michael@0: michael@0: int platGetAudioDeviceStatus(plat_audio_device_t device_type); michael@0: michael@0: /* michael@0: * Returns the default gateway michael@0: * michael@0: * @param void michael@0: * @return u_long michael@0: */ michael@0: cc_ulong_t platGetDefaultgw(); michael@0: michael@0: michael@0: #endif /* _PLATFORM_API_H_ */