media/webrtc/signaling/src/softphonewrapper/ccapi_plat_api_impl.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/src/softphonewrapper/ccapi_plat_api_impl.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,615 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +#include "CSFLog.h"
     1.9 +
    1.10 +#include "CC_Common.h"
    1.11 +#include "csf_common.h"
    1.12 +#ifdef WIN32
    1.13 +#include <windows.h>
    1.14 +#else
    1.15 +#ifdef LINUX
    1.16 +// for platGetIPAddr
    1.17 +#include <sys/ioctl.h>
    1.18 +#include <sys/types.h>
    1.19 +#include <arpa/inet.h>
    1.20 +#include <net/if.h>
    1.21 +#include <fcntl.h>
    1.22 +#endif
    1.23 +#endif
    1.24 +
    1.25 +#include "cpr_string.h"
    1.26 +
    1.27 +static const char* logTag = "sipcc";
    1.28 +
    1.29 +extern "C"
    1.30 +{
    1.31 +#include "plat_api.h"
    1.32 +#include <stdarg.h>
    1.33 +
    1.34 +
    1.35 +void NotifyStateChange (cc_callid_t callid, int32_t state) {
    1.36 +    //Don't need anything here.
    1.37 +    //Call state change are notified to us via SIPCC "high level" API
    1.38 +}
    1.39 +
    1.40 +#ifndef OSX
    1.41 +/**
    1.42 + *  platGetFeatureAllowed
    1.43 + *
    1.44 + *      Get whether the feature is allowed
    1.45 + *
    1.46 + *  @param featureId - sis feature id
    1.47 + *
    1.48 + *  @return  1 - allowed, 0 - not allowed
    1.49 + *
    1.50 + */
    1.51 +int platGetFeatureAllowed(cc_sis_feature_id_e featureId) {
    1.52 +    return 1;
    1.53 +}
    1.54 +
    1.55 +/**
    1.56 + * Set the Status message for failure reasons
    1.57 + * @param char *msg
    1.58 + * @return void
    1.59 + */
    1.60 +void platSetStatusMessage(char *msg) {
    1.61 +}
    1.62 +
    1.63 + /**
    1.64 +  * Sets the time based on Date header in 200 OK from REGISTER request
    1.65 +  * @param void
    1.66 +  * @return void
    1.67 +  */
    1.68 +void platSetCucmRegTime (void) {
    1.69 +}
    1.70 +
    1.71 +/**
    1.72 + * Enable / disable speaker
    1.73 + *
    1.74 + * @param[in] state - true -> enable speaker, false -> disable speaker
    1.75 + *
    1.76 + * @return void
    1.77 + */
    1.78 +extern "C" void platSetSpeakerMode(cc_boolean state) {
    1.79 +}
    1.80 +
    1.81 +/**
    1.82 + * Get the status (on/off) of the audio device
    1.83 + *
    1.84 + * @param[in]  device_type - headset or speaker (see vcm_audio_device_t)
    1.85 + *
    1.86 + * @return 1 -> On, 0 -> off, ERROR -> unknown (error)
    1.87 + */
    1.88 +int platGetAudioDeviceStatus(plat_audio_device_t device_type) {
    1.89 +    //Tell SIPCC what the current audio path is by return 1 for one of either: headset or speaker.
    1.90 +    return 1;
    1.91 +}
    1.92 +
    1.93 +/**
    1.94 + * Check if the speaker or headset is enabled.
    1.95 + *
    1.96 + * @return boolean if the speaker or headset is enabled, returns true.
    1.97 + */
    1.98 +boolean platGetSpeakerHeadsetMode() {
    1.99 +    return TRUE;
   1.100 +}
   1.101 +#endif
   1.102 +
   1.103 +/**
   1.104 + * Provides the local MAC address
   1.105 + *
   1.106 + * @param *maddr the pointer to the string holding MAC address
   1.107 + *             in the MAC address format after converting from string format.
   1.108 + * @return void
   1.109 + */
   1.110 +void platGetMacAddr(char *maddr) {
   1.111 +    //Strictly speaking the code using this is not treating this as a string.
   1.112 +    //It's taking the first 6 bytes out of the buffer, and printing these
   1.113 +    //directly, so it's not enough to just make the first byte '\0' need
   1.114 +    //to set all of the bytes in range 0-5 equal to '\0'.
   1.115 +    //Have to assume here that the buffer is big enough.
   1.116 +    for (int i=0; i<6; i++)
   1.117 +    {
   1.118 +        *(maddr+i) = '\0';
   1.119 +    }
   1.120 +}
   1.121 +
   1.122 +#ifndef OSX
   1.123 +/**
   1.124 + * Called by the thread to initialize any thread specific data
   1.125 + * once the thread is created.
   1.126 + *
   1.127 + * @param[in] tname       thread name
   1.128 + *
   1.129 + * @return 0 - SUCCESS
   1.130 + *        -1 - FAILURE
   1.131 + */
   1.132 +int platThreadInit(char * tname) {
   1.133 +    return 0;
   1.134 +}
   1.135 +
   1.136 +/**
   1.137 + * The initial initialization function for any platform related
   1.138 + * modules
   1.139 + *
   1.140 + *
   1.141 + * @return 0 - SUCCESS
   1.142 + *        -1 - FAILURE
   1.143 + */
   1.144 +int platInit() {
   1.145 +    return 0;
   1.146 +}
   1.147 +
   1.148 +/**
   1.149 + * The initial initialization function for the debugging/logging
   1.150 + * modules
   1.151 + *
   1.152 + */
   1.153 +void debugInit() {
   1.154 +    return ;
   1.155 +}
   1.156 +
   1.157 +/**
   1.158 + * Add cc control classifier
   1.159 + *
   1.160 + * Called by SIP stack to specify addresses and ports that will be used for call control
   1.161 + *
   1.162 + * @param[in] myIPAddr - phone local interface IP Address
   1.163 + * @param[in] myPort - phone local interface Port
   1.164 + * @param[in] cucm1IPAddr - CUCM 1 IP Address
   1.165 + * @param[in] cucm1Port - CUCM 1 Port
   1.166 + * @param[in] cucm2IPAddr - CUCM 2 IP Address
   1.167 + * @param[in] cucm2Port - CUCM 2 Port
   1.168 + * @param[in] cucm3IPAddr - CUCM 3 IP Address
   1.169 + * @param[in] cucm3Port - CUCM 3 Port
   1.170 + * @param[in] protocol - CC_IPPROTO_UDP or CC_IP_PROTO_TCP
   1.171 + *
   1.172 + * @note : Needed only if using WiFi. If not using Wifi please provide a stub
   1.173 + */
   1.174 +void platAddCallControlClassifiers(unsigned long myIPAddr, unsigned short myPort,
   1.175 +	unsigned long cucm1IPAddr, unsigned short cucm1Port,
   1.176 +	unsigned long cucm2IPAddr, unsigned short cucm2Port,
   1.177 +	unsigned long cucm3IPAddr, unsigned short cucm3Port,
   1.178 +	unsigned char  protocol) {
   1.179 +    //Needed only if using WiFi. If not using Wifi please provide a stub
   1.180 +}
   1.181 +
   1.182 +/**
   1.183 + * Remove cc control classifier.
   1.184 + *
   1.185 + * Undo platAddCallControlClassifiers
   1.186 + */
   1.187 +void platRemoveCallControlClassifiers() {
   1.188 +    //Needed only if using WiFi. If not using Wifi please provide a stub
   1.189 +}
   1.190 +
   1.191 +/**
   1.192 + * Set ip address mode
   1.193 + * e.g.
   1.194 + *
   1.195 + */
   1.196 +cpr_ip_mode_e platGetIpAddressMode() {
   1.197 +    return CPR_IP_MODE_IPV4;
   1.198 +}
   1.199 +
   1.200 +/**
   1.201 + * Tell whether wifi is supported and active
   1.202 + *
   1.203 + * @return boolean wether WLAN is active or not
   1.204 + */
   1.205 +cc_boolean	platWlanISActive() {
   1.206 +    return FALSE;
   1.207 +}
   1.208 +
   1.209 +/**
   1.210 + * Check if the network interface changed.
   1.211 + *
   1.212 + * @return boolean returns TRUE if the network interface has changed
   1.213 + *
   1.214 + * @note Most common case is for softphone clients where if a PC is
   1.215 + * undocked the network interface changes from wired to wireless.
   1.216 + */
   1.217 +boolean	platIsNetworkInterfaceChanged() {
   1.218 +    //We're OK with this
   1.219 +    return FALSE;
   1.220 +}
   1.221 +
   1.222 +/**
   1.223 + * Get active phone load name
   1.224 + *
   1.225 + * Returns the phone images in the active and inactive partitions
   1.226 + * The phone reports these phone loads to CUCM for display on the Admin page
   1.227 + *
   1.228 + * @param[in] image_a : Populate the image name from partition a
   1.229 + * @param[in] image_b : Populate the image name from partition b
   1.230 + * @param[in] len : Length of the pointers for image_a and image_b
   1.231 + * @return 1 - image_a is active.
   1.232 + *         Anything other than 1 - image_b is active
   1.233 + */
   1.234 +int platGetActiveInactivePhoneLoadName(char * image_a, char * image_b, int len) {
   1.235 +    if (image_a != nullptr)
   1.236 +    {
   1.237 +        sstrncpy(image_a, "image_a", len);
   1.238 +    }
   1.239 +
   1.240 +    if (image_b != nullptr)
   1.241 +    {
   1.242 +        sstrncpy(image_b, "image_b", len);
   1.243 +    }
   1.244 +
   1.245 +    return 1;
   1.246 +}
   1.247 +
   1.248 +/**
   1.249 + * Get or Set user defined phrases
   1.250 + * @param index  the phrase index, see
   1.251 + * @param phrase the return phrase holder
   1.252 + * @param len the input length to cap the maximum value
   1.253 + * @return SUCCESS or FAILURE
   1.254 + */
   1.255 +int platGetPhraseText(int index, char* phrase, unsigned int len) {
   1.256 +    //Need to copy something into "phrase" as this is used as a prefix
   1.257 +    //in a starts with comparison (use strncmp) that will match against
   1.258 +    //any string if the prefix is empty. Also in some places an
   1.259 +    //uninitialized buffer is passed in as "phrase", so if we don't
   1.260 +    //do something then SIPCC will go on the use the uninitialized
   1.261 +    //buffer.
   1.262 +
   1.263 +    if (phrase == nullptr)
   1.264 +    {
   1.265 +        return CC_FAILURE;
   1.266 +    }
   1.267 +
   1.268 +    sstrncpy(phrase, "?????", len);
   1.269 +
   1.270 +    return (int) CC_SUCCESS;
   1.271 +}
   1.272 +
   1.273 +/**
   1.274 + * Get the unregistration reason code.
   1.275 + * @return reason code for unregistration, see the definition.
   1.276 + */
   1.277 +int platGetUnregReason() {
   1.278 +    return 0;
   1.279 +}
   1.280 +
   1.281 +/**
   1.282 + * Set the unregistration reason
   1.283 + * @param reason see the unregister reason definitions.
   1.284 + * @return void
   1.285 + */
   1.286 +void platSetUnregReason(int reason) {
   1.287 +    //We may need to persist this for CUCM. WHen we restart next time call to platGetUnregReason above tells CUCM what why we unregistered last time.
   1.288 +    typedef struct _unRegRreasonEnumPair {
   1.289 +        int reason;
   1.290 +        const char * pReasonStr;
   1.291 +    } unRegRreasonEnumPair;
   1.292 +
   1.293 +    static unRegRreasonEnumPair unRegReasons[] = {
   1.294 +      { CC_UNREG_REASON_UNSPECIFIED, "CC_UNREG_REASON_UNSPECIFIED" },
   1.295 +      { CC_UNREG_REASON_TCP_TIMEOUT, "CC_UNREG_REASON_TCP_TIMEOUT" },
   1.296 +      { CC_UNREG_REASON_CM_RESET_TCP, "CC_UNREG_REASON_CM_RESET_TCP" },
   1.297 +      { CC_UNREG_REASON_CM_ABORTED_TCP, "CC_UNREG_REASON_CM_ABORTED_TCP" },
   1.298 +      { CC_UNREG_REASON_CM_CLOSED_TCP, "C_UNREG_REASON_CM_CLOSED_TCP" },
   1.299 +      { CC_UNREG_REASON_REG_TIMEOUT, "CC_UNREG_REASON_REG_TIMEOUT" },
   1.300 +      { CC_UNREG_REASON_FALLBACK, "CC_UNREG_REASON_FALLBACK" },
   1.301 +      { CC_UNREG_REASON_PHONE_KEYPAD, "CC_UNREG_REASON_PHONE_KEYPAD" },
   1.302 +      { CC_UNREG_REASON_RESET_RESET, "CC_UNREG_REASON_RESET_RESET" },
   1.303 +      { CC_UNREG_REASON_RESET_RESTART, "CC_UNREG_REASON_RESET_RESTART" },
   1.304 +      { CC_UNREG_REASON_PHONE_REG_REJ, "CC_UNREG_REASON_PHONE_REG_REJ" },
   1.305 +      { CC_UNREG_REASON_PHONE_INITIALIZED, "CC_UNREG_REASON_PHONE_INITIALIZED" },
   1.306 +      { CC_UNREG_REASON_VOICE_VLAN_CHANGED, "CC_UNREG_REASON_VOICE_VLAN_CHANGED" },
   1.307 +      { CC_UNREG_REASON_POWER_SAVE_PLUS, "CC_UNREG_REASON_POWER_SAVE_PLUS" },
   1.308 +      { CC_UNREG_REASON_VERSION_STAMP_MISMATCH, "CC_UNREG_REASON_VERSION_STAMP_MISMATCH" },
   1.309 +      { CC_UNREG_REASON_VERSION_STAMP_MISMATCH_CONFIG, "CC_UNREG_REASON_VERSION_STAMP_MISMATCH_CONFIG" },
   1.310 +      { CC_UNREG_REASON_VERSION_STAMP_MISMATCH_SOFTKEY, "CC_UNREG_REASON_VERSION_STAMP_MISMATCH_SOFTKEY" },
   1.311 +      { CC_UNREG_REASON_VERSION_STAMP_MISMATCH_DIALPLAN, "CC_UNREG_REASON_VERSION_STAMP_MISMATCH_DIALPLAN" },
   1.312 +      { CC_UNREG_REASON_APPLY_CONFIG_RESTART, "CC_UNREG_REASON_APPLY_CONFIG_RESTART" },
   1.313 +      { CC_UNREG_REASON_CONFIG_RETRY_RESTART, "CC_UNREG_REASON_CONFIG_RETRY_RESTART" },
   1.314 +      { CC_UNREG_REASON_TLS_ERROR, "CC_UNREG_REASON_TLS_ERROR" },
   1.315 +      { CC_UNREG_REASON_RESET_TO_INACTIVE_PARTITION, "CC_UNREG_REASON_RESET_TO_INACTIVE_PARTITION" },
   1.316 +      { CC_UNREG_REASON_VPN_CONNECTIVITY_LOST, "CC_UNREG_REASON_VPN_CONNECTIVITY_LOST" }
   1.317 +    };
   1.318 +
   1.319 +    for (int i=0; i< (int) csf_countof(unRegReasons); i++)
   1.320 +    {
   1.321 +        unRegRreasonEnumPair * pCurrentUnRegReasonPair = &unRegReasons[i];
   1.322 +
   1.323 +        if (pCurrentUnRegReasonPair->reason == reason)
   1.324 +        {
   1.325 +            CSFLogDebug( logTag, "platSetUnregReason(%s)", pCurrentUnRegReasonPair->pReasonStr);
   1.326 +            return;
   1.327 +        }
   1.328 +    }
   1.329 +
   1.330 +    CSFLogError( logTag, "Unknown reason code (%d) passed to platSetUnregReason()", reason);
   1.331 +}
   1.332 +
   1.333 +
   1.334 +#endif
   1.335 +
   1.336 +#ifndef OSX
   1.337 +/**
   1.338 + * Set the kpml value for application.
   1.339 + * @param kpml_config the kpml value
   1.340 + * @return void
   1.341 + */
   1.342 +void platSetKPMLConfig(cc_kpml_config_t kpml_config) {
   1.343 +}
   1.344 +
   1.345 +/**
   1.346 + * Check if a line has active MWI status
   1.347 + * @param line
   1.348 + * @return boolean
   1.349 + */
   1.350 +boolean platGetMWIStatus(cc_lineid_t line) {
   1.351 +    return TRUE;
   1.352 +}
   1.353 +
   1.354 +
   1.355 +/**
   1.356 + * Secure Socket API's.
   1.357 + * The pSIPCC expects the following Secure Socket APIs to be implemented in the
   1.358 + * vendor porting layer.
   1.359 + */
   1.360 +
   1.361 +/**
   1.362 + * platSecIsServerSecure
   1.363 + *
   1.364 + * @brief Lookup the secure status of the server
   1.365 + *
   1.366 + * This function looks at the the CCM server type by using the security library
   1.367 + * and returns appropriate indication to the pSIPCC.
   1.368 + *
   1.369 + *
   1.370 + * @return   Server is security enabled or not
   1.371 + *           PLAT_SOCK_SECURE or PLAT_SOCK_NONSECURE
   1.372 + *
   1.373 + * @note This API maps to the following HandyIron API:
   1.374 + *  int secIsServerSecure(SecServerType type) where type should be SRVR_TYPE_CCM
   1.375 + */
   1.376 +plat_soc_status_e platSecIsServerSecure(void) {
   1.377 +    return PLAT_SOCK_NONSECURE;
   1.378 +}
   1.379 +
   1.380 +
   1.381 +/**
   1.382 + * platSecSocConnect
   1.383 + * @brief  Securely connect to a remote server
   1.384 + *
   1.385 + * This function uses the security library APIs to connect to a remote server.
   1.386 + * @param[in]  host         server addr
   1.387 + * @param[in]  port         port number
   1.388 + * @param[in]  ipMode       IP mode to indicate v6, v4 or both
   1.389 + * @param[in]  mode         blocking connect or not
   1.390 + *                          FALSE: non-blocking; TRUE: blocking
   1.391 + * @param[in]  tos          TOS value
   1.392 + * @param[in]  connectionType Are we talking to Call-Agent
   1.393 + * @param[in]  connectionMode The mode of the connection
   1.394 + *                            (Authenticated/Encrypted)
   1.395 + * @param[out] localPort    local port used for the connection
   1.396 + *
   1.397 + * @return     client socket descriptor
   1.398 + *             >=0: connected or in progress
   1.399 + *             INVALID SOCKET: failed
   1.400 + *
   1.401 + * @pre        (hostAndPort not_eq nullptr)
   1.402 + * @pre        (localPort   not_eq nullptr)
   1.403 + *
   1.404 + * @note localPort is undefined when the return value is INVALID_SOCKET
   1.405 + *
   1.406 + * @note This API maps to the HandyIron APIs as follows:
   1.407 + * If mode == TRUE (blocking):
   1.408 + *    int secEstablishSecureConnection(const char* serverAddr, *uint32_t port, secConnectionType type)
   1.409 + *    @li ipMode is UNUSED
   1.410 + *    @li "host" maps to "serverAddr", "connectionType" maps to "type"
   1.411 + *    @li localPort is passed in as 0
   1.412 + * If mode == FALSE (non-blocking):
   1.413 + *     int secConnect(const char* serverAddr, uint32_t port, *secConnectionType type, uint32_t localPort)
   1.414 + *    @li ipMode is UNUSED
   1.415 + *    @li "host" maps to "serverAddr", "connectionType" maps to "type"
   1.416 + *
   1.417 + * @note The implementation should use the "setsockopt" to set the "tos" value passed
   1.418 + * in this API on the created socket.
   1.419 + *
   1.420 + */
   1.421 +cpr_socket_t
   1.422 +platSecSocConnect (char *host,
   1.423 +                  int     port,
   1.424 +                  int     ipMode,
   1.425 +                  boolean mode,
   1.426 +                  unsigned int tos,
   1.427 +                  plat_soc_connect_mode_e connectionMode,
   1.428 +                  uint16_t *localPort) {
   1.429 +    return 0;
   1.430 +}
   1.431 +
   1.432 +/**
   1.433 + * platSecSockIsConnected
   1.434 + * Determine the status of a secure connection that was initiated
   1.435 + * in non-blocking mode
   1.436 + *
   1.437 + * @param[in]    sock   socket descriptor
   1.438 + *
   1.439 + * @return   connection status
   1.440 + *           @li connection complete: PLAT_SOCK_CONN_OK
   1.441 + *           @li connection waiting:  PLAT_SOCK_CONN_WAITING
   1.442 + *           @li connection failed:   PLAT_SOCK_CONN_FAILED
   1.443 + *
   1.444 + * @note This API maps to the following HandyIron API:
   1.445 + * int secIsConnectionReady (int connDesc)
   1.446 + * The "sock" is the connection descriptor.
   1.447 + */
   1.448 +plat_soc_connect_status_e platSecSockIsConnected (cpr_socket_t sock) {
   1.449 +    return PLAT_SOCK_CONN_OK;
   1.450 +}
   1.451 +#endif //#endif !OSX
   1.452 +
   1.453 +/**
   1.454 + * platGenerateCryptoRand
   1.455 + * @brief Generates a Random Number
   1.456 + *
   1.457 + * Generate crypto graphically random number for a desired length.
   1.458 + * The function is expected to be much slower than the cpr_rand().
   1.459 + * This function should be used when good random number is needed
   1.460 + * such as random number that to be used for SRTP key for an example.
   1.461 + *
   1.462 + * @param[in] buf  - pointer to the buffer to store the result of random
   1.463 + *                   bytes requested.
   1.464 + * @param[in] len  - pointer to the length of the desired random bytes.
   1.465 + *             When calling the function, the integer's value
   1.466 + *             should be set to the desired number of random
   1.467 + *             bytes ('buf' should be of at least this size).
   1.468 + *             upon success, its value will be set to the
   1.469 + *             actual number of random bytes being returned.
   1.470 + *             (realistically, there is a maximum number of
   1.471 + *             random bytes that can be returned at a time.
   1.472 + *             if the caller request more than that, the
   1.473 + *             'len' will indicate how many bytes are actually being
   1.474 + *             returned) on failure, its value will be set to 0.
   1.475 + *
   1.476 + * @return
   1.477 + *     1 - success.
   1.478 + *     0 - fail.
   1.479 + *
   1.480 + * @note The intent of this function is to generate a cryptographically strong
   1.481 + * random number. Vendors can map this to HandyIron or OpenSSL random number
   1.482 + * generation functions.
   1.483 + *
   1.484 + * @note This API maps to the following HandyIron API:
   1.485 + * int secGetRandomData(uint8_t *buf, uint32_t size). Also note that a
   1.486 + * "secAddEntropy(...)" may be required the first time to feed entropy data to
   1.487 + * the random number generator.
   1.488 + */
   1.489 +#ifdef LINUX
   1.490 +int platGenerateCryptoRand(uint8_t *buf, int *len) {
   1.491 +    int fd;
   1.492 +    int rc = 0;
   1.493 +    ssize_t s;
   1.494 +
   1.495 +    if ((fd = open("/dev/urandom", O_RDONLY)) == -1) {
   1.496 +          CSFLogDebug( logTag, "Failed to open prng driver");
   1.497 +        return 0;
   1.498 +    }
   1.499 +
   1.500 +    /*
   1.501 +     * Try to read the given amount of bytes from the PRNG device.  We do not
   1.502 +     * handle short reads but just return the number of bytes read from the
   1.503 +     * device.  The caller has to manage this.
   1.504 +     * E.g. gsmsdp_generate_key() in core/gsm/gsm_sdp_crypto.c
   1.505 +     */
   1.506 +
   1.507 +    s = read(fd, buf, (size_t) *len);
   1.508 +
   1.509 +    if (s > 0) {
   1.510 +        *len = s;
   1.511 +        rc = 1; /* Success */
   1.512 +    } else {
   1.513 +        *len = 0;
   1.514 +        rc = 0; /* Failure */
   1.515 +    }
   1.516 +
   1.517 +
   1.518 +    (void) close(fd);
   1.519 +    return rc;
   1.520 +}
   1.521 +#else
   1.522 +int platGenerateCryptoRand(uint8_t *buf, int *len) {
   1.523 +    return 0;
   1.524 +}
   1.525 +#endif//!LINUX
   1.526 +
   1.527 +#ifndef OSX
   1.528 +
   1.529 +/*
   1.530 +  <Umesh> The version is to regulate certain features like Join, which are added in later releases.
   1.531 +  This is exchanged during registration with CUCM. It is a sheer luck that join may be working in some cases.
   1.532 +  In this case Set API you have to store each of those API and return the same value in get.
   1.533 +
   1.534 +  We can go over all platform API’ and see which one are mandatory, we can do this in an email or in a  meeting.
   1.535 +  Please send out list methods for which you need clarification.
   1.536 +*/
   1.537 +static cc_uint32_t majorSIS=1, minorSIS=0, addtnlSIS =0;
   1.538 +static char sis_ver_name[CC_MAX_LEN_REQ_SUPP_PARAM_CISCO_SISTAG] = {0};
   1.539 +
   1.540 +/**
   1.541 + * Sets the SIS protocol version
   1.542 + *
   1.543 + * @param a - major version
   1.544 + * @param b - minor version
   1.545 + * @param c - additional version information
   1.546 + * @param name - version name
   1.547 + *
   1.548 + * @return void
   1.549 + * @note the platform should store this information and provide it when asked via the platGetSISProtocolVer()
   1.550 + */
   1.551 +void platSetSISProtocolVer(cc_uint32_t a, cc_uint32_t b, cc_uint32_t c, char* name) {
   1.552 +   majorSIS = a;
   1.553 +   minorSIS = b;
   1.554 +   addtnlSIS = c;
   1.555 +
   1.556 +   if (name) {
   1.557 +       sstrncpy(sis_ver_name, name, csf_countof(sis_ver_name));
   1.558 +   } else {
   1.559 +       *sis_ver_name = '\0';
   1.560 +   }
   1.561 +}
   1.562 +
   1.563 +/**
   1.564 + * Provides the SIS protocol version
   1.565 + *
   1.566 + * @param *a pointer to fill in the major version
   1.567 + * @param *b pointer to fill in the minor version
   1.568 + * @param *c pointer to fill in the additonal version
   1.569 + * @param *name pointer to fill in the version name
   1.570 + *
   1.571 + * @return void
   1.572 + */
   1.573 +void
   1.574 +platGetSISProtocolVer (cc_uint32_t *a, cc_uint32_t *b, cc_uint32_t *c, char* name) {
   1.575 +
   1.576 +    if (a != nullptr)
   1.577 +    {
   1.578 +        *a = majorSIS;
   1.579 +    }
   1.580 +
   1.581 +    if (b != nullptr)
   1.582 +    {
   1.583 +        *b = minorSIS;
   1.584 +    }
   1.585 +
   1.586 +    if (c != nullptr)
   1.587 +    {
   1.588 +        *c = addtnlSIS;
   1.589 +    }
   1.590 +
   1.591 +    if (name != nullptr)
   1.592 +    {
   1.593 +       sstrncpy(name, sis_ver_name, CC_MAX_LEN_REQ_SUPP_PARAM_CISCO_SISTAG);
   1.594 +    }
   1.595 +
   1.596 +    return;
   1.597 +}
   1.598 +
   1.599 +void debug_bind_keyword(const char *cmd, int32_t *flag_ptr) {
   1.600 +    return;
   1.601 +}
   1.602 +
   1.603 +void debugif_add_keyword(const char *x, const char *y) {
   1.604 +    return;
   1.605 +}
   1.606 +#endif
   1.607 +
   1.608 +// Keep this when we are building the sipcc library without it, so that we capture logging
   1.609 +int debugif_printf(const char *_format, ...) {
   1.610 +    va_list ap;
   1.611 +    va_start(ap, _format);
   1.612 +	CSFLogDebugV( logTag, _format, ap);
   1.613 +    va_end(ap);
   1.614 +	return 1;	// Fake a "happy" return value.
   1.615 +}
   1.616 +
   1.617 +}
   1.618 +

mercurial