media/webrtc/signaling/src/sipcc/plat/darwin/plat_api_stub.c

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/media/webrtc/signaling/src/sipcc/plat/darwin/plat_api_stub.c	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,448 @@
     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 <string.h>
     1.9 +
    1.10 +#include "cpr_types.h"
    1.11 +#include "cc_constants.h"
    1.12 +#include "cpr_socket.h"
    1.13 +#include "plat_api.h"
    1.14 +
    1.15 +/**
    1.16 + * Initialize the platform threa.
    1.17 + * @todo add more explanation here.
    1.18 + */
    1.19 +int platThreadInit(char * tname)
    1.20 +{
    1.21 +    return 0;
    1.22 +}
    1.23 +
    1.24 +/**
    1.25 + * The initial initialization function for any platform related
    1.26 + * modules
    1.27 + *
    1.28 + *
    1.29 + * @return 0 - SUCCESS
    1.30 + *        -1 - FAILURE
    1.31 + */
    1.32 +int platInit()
    1.33 +{
    1.34 +    return 0;
    1.35 +}
    1.36 +
    1.37 +/**
    1.38 + * The initial initialization function for the debugging/logging
    1.39 + * modules
    1.40 + *
    1.41 + *
    1.42 + * @return 0 - SUCCESS
    1.43 + *        -1 - FAILURE
    1.44 + */
    1.45 +void debugInit()
    1.46 +{
    1.47 +    return ;
    1.48 +}
    1.49 +
    1.50 +/**
    1.51 + * Add cc control classifier
    1.52 + */
    1.53 +void platAddCallControlClassifiers(unsigned long myIPAddr, unsigned short myPort,
    1.54 +	unsigned long cucm1IPAddr, unsigned short cucm1Port,
    1.55 +	unsigned long cucm2IPAddr, unsigned short cucm2Port,
    1.56 +	unsigned long cucm3IPAddr, unsigned short cucm3Port,
    1.57 +	unsigned char  protocol)
    1.58 +{
    1.59 +    return;
    1.60 +}
    1.61 +
    1.62 +/**
    1.63 + * Set ip address mode
    1.64 + * e.g.
    1.65 + *
    1.66 + */
    1.67 +cpr_ip_mode_e platGetIpAddressMode()
    1.68 +{
    1.69 +    return CPR_IP_MODE_IPV4;
    1.70 +}
    1.71 +
    1.72 +/**
    1.73 + * Remove cc control classifier.
    1.74 + */
    1.75 +void platRemoveCallControlClassifiers()
    1.76 +{
    1.77 +    return;
    1.78 +}
    1.79 +
    1.80 +/**
    1.81 + * Tell whether wifi is supported and active
    1.82 + */
    1.83 +cc_boolean	platWlanISActive()
    1.84 +{
    1.85 +    return FALSE;
    1.86 +}
    1.87 +
    1.88 +/**
    1.89 + * Check if the netowrk interface changed.
    1.90 + */
    1.91 +boolean	platIsNetworkInterfaceChanged()// (NOOP)
    1.92 +{
    1.93 +    return TRUE;
    1.94 +}
    1.95 +
    1.96 +/**
    1.97 + * Set active phone load name
    1.98 + * @return FAILURE or true length. "-1" means no active load found.
    1.99 + *
   1.100 + */
   1.101 +int platGetActiveInactivePhoneLoadName(char * image_a, char * image_b, int len)
   1.102 +{
   1.103 +    memset(image_a, 0, len);
   1.104 +    memset(image_b, 0, len);
   1.105 +
   1.106 +    return 0;
   1.107 +}
   1.108 +
   1.109 +/**
   1.110 + * Get or Set user defined phrases
   1.111 + * @param index  the phrase index, see
   1.112 + * @param phrase the return phrase holder
   1.113 + * @param len the input length to cap the maximum value
   1.114 + * @return SUCCESS or FAILURE
   1.115 + */
   1.116 +int platGetPhraseText(int index, char* phrase, unsigned int len)
   1.117 +{
   1.118 +    return 0;
   1.119 +}
   1.120 +
   1.121 +/**
   1.122 + * Set the unregistration reason
   1.123 + * @param reason see the unregister reason definitions.
   1.124 + * @return void
   1.125 + */
   1.126 +void platSetUnregReason(int reason)
   1.127 +{
   1.128 +    return;
   1.129 +}
   1.130 +
   1.131 +/**
   1.132 + * Get the unregistration reason code.
   1.133 + * @return reason code for unregistration, see the definition.
   1.134 + */
   1.135 +int platGetUnregReason()
   1.136 +{
   1.137 +    return 0;
   1.138 +}
   1.139 +
   1.140 +/**
   1.141 + * Set the kpml value for application.
   1.142 + * @param kpml_config the kpml value
   1.143 + * @return void
   1.144 + */
   1.145 +void platSetKPMLConfig(cc_kpml_config_t kpml_config)
   1.146 +{
   1.147 +    return ;
   1.148 +}
   1.149 +
   1.150 +/**
   1.151 + * Check if a line has active MWI status
   1.152 + * @param line
   1.153 + * @return boolean
   1.154 + */
   1.155 +boolean platGetMWIStatus(cc_lineid_t line)
   1.156 +{
   1.157 +    return TRUE;
   1.158 +}
   1.159 +
   1.160 +
   1.161 +/**
   1.162 + * Secure Socket API's.
   1.163 + * The pSIPCC expects the following Secure Socket APIs to be implemented in the
   1.164 + * vendor porting layer.
   1.165 + */
   1.166 +
   1.167 +/**
   1.168 + * platSecIsServerSecure
   1.169 + *
   1.170 + * @brief Lookup the secure status of the server
   1.171 + *
   1.172 + * This function looks at the the CCM server type by using the security library
   1.173 + * and returns appropriate indication to the pSIPCC.
   1.174 + *
   1.175 + *
   1.176 + * @return   Server is security enabled or not
   1.177 + *           PLAT_SOCK_SECURE or PLAT_SOCK_NONSECURE
   1.178 + *
   1.179 + * @note This API maps to the following HandyIron API:
   1.180 + *  int secIsServerSecure(SecServerType type) where type should be SRVR_TYPE_CCM
   1.181 + */
   1.182 +plat_soc_status_e platSecIsServerSecure(void)
   1.183 +{
   1.184 +    return PLAT_SOCK_NONSECURE;
   1.185 +}
   1.186 +
   1.187 +
   1.188 +/**
   1.189 + * platSecSocConnect
   1.190 + * @brief  Securely connect to a remote server
   1.191 + *
   1.192 + * This function uses the security library APIs to connect to a remote server.
   1.193 + * @param[in]  host         server addr
   1.194 + * @param[in]  port         port number
   1.195 + * @param[in]  ipMode       IP mode to indicate v6, v4 or both
   1.196 + * @param[in]  mode         blocking connect or not
   1.197 + *                          FALSE: non-blocking; TRUE: blocking
   1.198 + * @param[in]  tos          TOS value
   1.199 + * @param[in]  connectionType Are we talking to Call-Agent
   1.200 + * @param[in]  connectionMode The mode of the connection
   1.201 + *                            (Authenticated/Encrypted)
   1.202 + * @param[out] localPort    local port used for the connection
   1.203 + *
   1.204 + * @return     client socket descriptor
   1.205 + *             >=0: connected or in progress
   1.206 + *             INVALID SOCKET: failed
   1.207 + *
   1.208 + * @pre        (hostAndPort not_eq NULL)
   1.209 + * @pre        (localPort   not_eq NULL)
   1.210 + *
   1.211 + * @note localPort is undefined when the return value is INVALID_SOCKET
   1.212 + *
   1.213 + * @note This API maps to the HandyIron APIs as follows:
   1.214 + * If mode == TRUE (blocking):
   1.215 + *    int secEstablishSecureConnection(const char* serverAddr, *uint32_t port, secConnectionType type)
   1.216 + *    @li ipMode is UNUSED
   1.217 + *    @li "host" maps to "serverAddr", "connectionType" maps to "type"
   1.218 + *    @li localPort is passed in as 0
   1.219 + * If mode == FALSE (non-blocking):
   1.220 + *     int secConnect(const char* serverAddr, uint32_t port, *secConnectionType type, uint32_t localPort)
   1.221 + *    @li ipMode is UNUSED
   1.222 + *    @li "host" maps to "serverAddr", "connectionType" maps to "type"
   1.223 + *
   1.224 + * @note The implementation should use the "setsockopt" to set the "tos" value passed
   1.225 + * in this API on the created socket.
   1.226 + *
   1.227 + */
   1.228 +cpr_socket_t
   1.229 +platSecSocConnect (char *host,
   1.230 +                  int     port,
   1.231 +                  int     ipMode,
   1.232 +                  boolean mode,
   1.233 +                  unsigned int tos,
   1.234 +                  plat_soc_connect_mode_e connectionMode,
   1.235 +                  uint16_t *localPort)
   1.236 +{
   1.237 +    return 0;
   1.238 +}
   1.239 +
   1.240 +/**
   1.241 + * platSecSockIsConnected
   1.242 + * Determine the status of a secure connection that was initiated
   1.243 + * in non-blocking mode
   1.244 + *
   1.245 + * @param[in]    sock   socket descriptor
   1.246 + *
   1.247 + * @return   connection status
   1.248 + *           @li connection complete: PLAT_SOCK_CONN_OK
   1.249 + *           @li connection waiting:  PLAT_SOCK_CONN_WAITING
   1.250 + *           @li connection failed:   PLAT_SOCK_CONN_FAILED
   1.251 + *
   1.252 + * @note This API maps to the following HandyIron API:
   1.253 + * int secIsConnectionReady (int connDesc)
   1.254 + * The "sock" is the connection descriptor.
   1.255 + */
   1.256 +plat_soc_connect_status_e platSecSockIsConnected (cpr_socket_t sock)
   1.257 +{
   1.258 +    return PLAT_SOCK_CONN_OK;
   1.259 +}
   1.260 +
   1.261 +/**
   1.262 + * platSecSocSend
   1.263 + *
   1.264 + * @brief The platSecSocSend() function is used to send data over a secure
   1.265 + * socket.
   1.266 + *
   1.267 + * The platSecSocSend() function shall transmit a message from the specified socket to
   1.268 + * its peer. The platSecSocSend() function shall send a message only when the socket is
   1.269 + * connected. The length of the message to be sent is specified by the length
   1.270 + * argument. If the message is too long to pass through the underlying protocol,
   1.271 + * platSecSocSend() shall fail and no data is transmitted.  Delivery of the message is
   1.272 + * not guaranteed.
   1.273 + *
   1.274 + * @param[in] soc  Specifies the socket created with cprSocket() to send
   1.275 + * @param[in] buf  A pointer to the buffer of the message to send.
   1.276 + * @param[in] len  Specifies the length in bytes of the message pointed to by the buffer argument.
   1.277 + *
   1.278 + * @return Upon successful completion, platSecSocSend() shall return the number of
   1.279 + *     bytes sent. Otherwise, SOCKET_ERROR shall be returned and cpr_errno set to
   1.280 + *     indicate the error.
   1.281 + *
   1.282 + * @note The possible error values this function should return are
   1.283 + *        @li [CPR_EBADF]  The socket argument is not a valid file descriptor
   1.284 + *        @li [CPR_ENOTSOCK]  socket does not refer to a socket descriptor
   1.285 + *        @li [CPR_EAGAIN]    The socket is marked non-blocking and no data can
   1.286 + *                          be sent
   1.287 + *        @li [CPR_EWOULDBLOCK]   Same as CPR_EAGAIN
   1.288 + *        @li [CPR_ENOTCONN]  A connection-mode socket that is not connected
   1.289 + *        @li [CPR_ENOTSUPP]  The specified flags are not supported for this
   1.290 + *                            type of socket or protocol.
   1.291 + *        @li [CPR_EMSGSIZE]  The message is too large to be sent all at once
   1.292 + *        @li [CPR_EDESTADDRREQ]  The socket has no peer address set
   1.293 + *
   1.294 + */
   1.295 +ssize_t
   1.296 +platSecSocSend (cpr_socket_t soc,
   1.297 +         CONST void *buf,
   1.298 +         size_t len)
   1.299 +{
   1.300 +    return 0;
   1.301 +}
   1.302 +
   1.303 +/**
   1.304 + * platSecSocRecv
   1.305 + *
   1.306 + * @brief The platSecSocRecv() function shall receive a message from a secure socket.
   1.307 + *
   1.308 + * This function is normally used with connected sockets because it does not permit
   1.309 + * the application to retrieve the source address of received data.  The
   1.310 + * platSecSocRecv() function shall return the length of the message written to
   1.311 + * the buffer pointed to by the "buf" argument.
   1.312 + *
   1.313 + * @param[in] soc  - Specifies the socket to receive data
   1.314 + * @param[out] buf  - Contains the data received
   1.315 + * @param[out] len  - The length of the data received
   1.316 + *
   1.317 + * @return On success the length of the message in bytes (including zero).
   1.318 + *         On failure SOCKET_ERROR shall be returned and cpr_errno set to
   1.319 + *         indicate the error.
   1.320 + *
   1.321 + * @note The possible error values this function should return are
   1.322 + *        @li [CPR_EBADF]  The socket argument is not a valid file descriptor
   1.323 + *        @li [CPR_ENOTSOCK]  The descriptor references a file, not a socket.
   1.324 + *        @li [CPR_EAGAIN]    The socket is marked non-blocking and no data is
   1.325 + *                        waiting to be received.
   1.326 + *        @li [CPR_EWOULDBLOCK]   Same as CPR_EAGAIN
   1.327 + *        @li [CPR_ENOTCONN]  A receive attempt is made on a connection-mode socket that is not connected
   1.328 + *        @li [CPR_ENOTSUPP]  The specified flags are not supported for this type of socket or protocol
   1.329 + *
   1.330 + */
   1.331 +ssize_t
   1.332 +platSecSocRecv (cpr_socket_t soc,
   1.333 +         void * RESTRICT buf,
   1.334 +         size_t len)
   1.335 +{
   1.336 +    return 0;
   1.337 +}
   1.338 +
   1.339 +/**
   1.340 + * platSecSocClose
   1.341 + *
   1.342 + * @brief The platSecSocClose function shall close a secure socket
   1.343 + *
   1.344 + * The platSecSocClose() function shall destroy the socket descriptor indicated
   1.345 + * by socket.
   1.346 + *
   1.347 + * @param[in] soc  - The socket that needs to be destroyed
   1.348 + *
   1.349 + * @return CPR_SUCCESS on success otherwise, CPR_FAILURE. cpr_errno needs to be set in this case.
   1.350 + *
   1.351 + * @note The possible error values this function should return are
   1.352 + *         @li [CPR_EBADF]      socket is not a valid socket descriptor.
   1.353 + */
   1.354 +cpr_status_e
   1.355 +platSecSocClose (cpr_socket_t soc)
   1.356 +{
   1.357 +    return CPR_SUCCESS;
   1.358 +}
   1.359 +
   1.360 +/**
   1.361 + * Sets the SIS protocol version
   1.362 + *
   1.363 + * @param a - major version
   1.364 + * @param b - minor version
   1.365 + * @param c - additional version information
   1.366 + *
   1.367 + * @return void
   1.368 + * @note the platform should store this information and provide it when asked via the platGetSISProtocolVer()
   1.369 + */
   1.370 +void platSetSISProtocolVer(uint32_t a, uint32_t b, uint32_t c, char* name)
   1.371 +{
   1.372 +    return;
   1.373 +}
   1.374 +
   1.375 +/**
   1.376 + * Provides the SIS protocol version
   1.377 + *
   1.378 + * @param *a pointer to fill in the major version
   1.379 + * @param *b pointer to fill in the minor version
   1.380 + * @param *c pointer to fill in the additonal version
   1.381 + *
   1.382 + * @return void
   1.383 + */
   1.384 +void
   1.385 +platGetSISProtocolVer (uint32_t *a, uint32_t *b, uint32_t *c, char* name)
   1.386 +{
   1.387 +    return;
   1.388 +}
   1.389 +
   1.390 +
   1.391 +void debug_bind_keyword(const char *cmd, int32_t *flag_ptr)
   1.392 +{
   1.393 +    return;
   1.394 +}
   1.395 +
   1.396 +void debugif_add_keyword(const char *x, const char *y)
   1.397 +{
   1.398 +    return;
   1.399 +}
   1.400 +
   1.401 +void platSetSpeakerMode(cc_boolean state)
   1.402 +{
   1.403 +    return;
   1.404 +}
   1.405 +
   1.406 +boolean platGetSpeakerHeadsetMode()
   1.407 +{
   1.408 +    return TRUE;
   1.409 +}
   1.410 +
   1.411 +/**
   1.412 + *  platGetFeatureAllowed
   1.413 + *
   1.414 + *      Get whether the feature is allowed
   1.415 + *
   1.416 + *  @param featureId - sis feature id
   1.417 + *
   1.418 + *  @return  1 - allowed, 0 - not allowed
   1.419 + *
   1.420 + */
   1.421 +int platGetFeatureAllowed(cc_sis_feature_id_e featureId)
   1.422 +{
   1.423 +    return TRUE;
   1.424 +}
   1.425 +
   1.426 +
   1.427 +int platGetAudioDeviceStatus(plat_audio_device_t device_type)
   1.428 +{
   1.429 +    return 0;
   1.430 +}
   1.431 +
   1.432 +
   1.433 +/*
   1.434 + * Returns the default gateway
   1.435 + *
   1.436 + * @param void
   1.437 + * @return u_long
   1.438 + */
   1.439 +cc_ulong_t platGetDefaultgw(){
   1.440 +	return 0;
   1.441 +}
   1.442 +
   1.443 +/**
   1.444 + * Sets the time based on Date header in 200 OK from REGISTER request
   1.445 + * @param void
   1.446 + * @return void
   1.447 + */
   1.448 +void platSetCucmRegTime (void) {
   1.449 +    //Noop
   1.450 +}
   1.451 +

mercurial