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

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rwxr-xr-x

Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.

michael@0 1 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 2 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 4
michael@0 5 #include <string.h>
michael@0 6
michael@0 7 #include "cpr_types.h"
michael@0 8 #include "cc_constants.h"
michael@0 9 #include "cpr_socket.h"
michael@0 10 #include "plat_api.h"
michael@0 11
michael@0 12 /**
michael@0 13 * Initialize the platform threa.
michael@0 14 * @todo add more explanation here.
michael@0 15 */
michael@0 16 int platThreadInit(char * tname)
michael@0 17 {
michael@0 18 return 0;
michael@0 19 }
michael@0 20
michael@0 21 /**
michael@0 22 * The initial initialization function for any platform related
michael@0 23 * modules
michael@0 24 *
michael@0 25 *
michael@0 26 * @return 0 - SUCCESS
michael@0 27 * -1 - FAILURE
michael@0 28 */
michael@0 29 int platInit()
michael@0 30 {
michael@0 31 return 0;
michael@0 32 }
michael@0 33
michael@0 34 /**
michael@0 35 * The initial initialization function for the debugging/logging
michael@0 36 * modules
michael@0 37 *
michael@0 38 *
michael@0 39 * @return 0 - SUCCESS
michael@0 40 * -1 - FAILURE
michael@0 41 */
michael@0 42 void debugInit()
michael@0 43 {
michael@0 44 return ;
michael@0 45 }
michael@0 46
michael@0 47 /**
michael@0 48 * Add cc control classifier
michael@0 49 */
michael@0 50 void platAddCallControlClassifiers(unsigned long myIPAddr, unsigned short myPort,
michael@0 51 unsigned long cucm1IPAddr, unsigned short cucm1Port,
michael@0 52 unsigned long cucm2IPAddr, unsigned short cucm2Port,
michael@0 53 unsigned long cucm3IPAddr, unsigned short cucm3Port,
michael@0 54 unsigned char protocol)
michael@0 55 {
michael@0 56 return;
michael@0 57 }
michael@0 58
michael@0 59 /**
michael@0 60 * Set ip address mode
michael@0 61 * e.g.
michael@0 62 *
michael@0 63 */
michael@0 64 cpr_ip_mode_e platGetIpAddressMode()
michael@0 65 {
michael@0 66 return CPR_IP_MODE_IPV4;
michael@0 67 }
michael@0 68
michael@0 69 /**
michael@0 70 * Remove cc control classifier.
michael@0 71 */
michael@0 72 void platRemoveCallControlClassifiers()
michael@0 73 {
michael@0 74 return;
michael@0 75 }
michael@0 76
michael@0 77 /**
michael@0 78 * Tell whether wifi is supported and active
michael@0 79 */
michael@0 80 cc_boolean platWlanISActive()
michael@0 81 {
michael@0 82 return FALSE;
michael@0 83 }
michael@0 84
michael@0 85 /**
michael@0 86 * Check if the netowrk interface changed.
michael@0 87 */
michael@0 88 boolean platIsNetworkInterfaceChanged()// (NOOP)
michael@0 89 {
michael@0 90 return TRUE;
michael@0 91 }
michael@0 92
michael@0 93 /**
michael@0 94 * Set active phone load name
michael@0 95 * @return FAILURE or true length. "-1" means no active load found.
michael@0 96 *
michael@0 97 */
michael@0 98 int platGetActiveInactivePhoneLoadName(char * image_a, char * image_b, int len)
michael@0 99 {
michael@0 100 memset(image_a, 0, len);
michael@0 101 memset(image_b, 0, len);
michael@0 102
michael@0 103 return 0;
michael@0 104 }
michael@0 105
michael@0 106 /**
michael@0 107 * Get or Set user defined phrases
michael@0 108 * @param index the phrase index, see
michael@0 109 * @param phrase the return phrase holder
michael@0 110 * @param len the input length to cap the maximum value
michael@0 111 * @return SUCCESS or FAILURE
michael@0 112 */
michael@0 113 int platGetPhraseText(int index, char* phrase, unsigned int len)
michael@0 114 {
michael@0 115 return 0;
michael@0 116 }
michael@0 117
michael@0 118 /**
michael@0 119 * Set the unregistration reason
michael@0 120 * @param reason see the unregister reason definitions.
michael@0 121 * @return void
michael@0 122 */
michael@0 123 void platSetUnregReason(int reason)
michael@0 124 {
michael@0 125 return;
michael@0 126 }
michael@0 127
michael@0 128 /**
michael@0 129 * Get the unregistration reason code.
michael@0 130 * @return reason code for unregistration, see the definition.
michael@0 131 */
michael@0 132 int platGetUnregReason()
michael@0 133 {
michael@0 134 return 0;
michael@0 135 }
michael@0 136
michael@0 137 /**
michael@0 138 * Set the kpml value for application.
michael@0 139 * @param kpml_config the kpml value
michael@0 140 * @return void
michael@0 141 */
michael@0 142 void platSetKPMLConfig(cc_kpml_config_t kpml_config)
michael@0 143 {
michael@0 144 return ;
michael@0 145 }
michael@0 146
michael@0 147 /**
michael@0 148 * Check if a line has active MWI status
michael@0 149 * @param line
michael@0 150 * @return boolean
michael@0 151 */
michael@0 152 boolean platGetMWIStatus(cc_lineid_t line)
michael@0 153 {
michael@0 154 return TRUE;
michael@0 155 }
michael@0 156
michael@0 157
michael@0 158 /**
michael@0 159 * Secure Socket API's.
michael@0 160 * The pSIPCC expects the following Secure Socket APIs to be implemented in the
michael@0 161 * vendor porting layer.
michael@0 162 */
michael@0 163
michael@0 164 /**
michael@0 165 * platSecIsServerSecure
michael@0 166 *
michael@0 167 * @brief Lookup the secure status of the server
michael@0 168 *
michael@0 169 * This function looks at the the CCM server type by using the security library
michael@0 170 * and returns appropriate indication to the pSIPCC.
michael@0 171 *
michael@0 172 *
michael@0 173 * @return Server is security enabled or not
michael@0 174 * PLAT_SOCK_SECURE or PLAT_SOCK_NONSECURE
michael@0 175 *
michael@0 176 * @note This API maps to the following HandyIron API:
michael@0 177 * int secIsServerSecure(SecServerType type) where type should be SRVR_TYPE_CCM
michael@0 178 */
michael@0 179 plat_soc_status_e platSecIsServerSecure(void)
michael@0 180 {
michael@0 181 return PLAT_SOCK_NONSECURE;
michael@0 182 }
michael@0 183
michael@0 184
michael@0 185 /**
michael@0 186 * platSecSocConnect
michael@0 187 * @brief Securely connect to a remote server
michael@0 188 *
michael@0 189 * This function uses the security library APIs to connect to a remote server.
michael@0 190 * @param[in] host server addr
michael@0 191 * @param[in] port port number
michael@0 192 * @param[in] ipMode IP mode to indicate v6, v4 or both
michael@0 193 * @param[in] mode blocking connect or not
michael@0 194 * FALSE: non-blocking; TRUE: blocking
michael@0 195 * @param[in] tos TOS value
michael@0 196 * @param[in] connectionType Are we talking to Call-Agent
michael@0 197 * @param[in] connectionMode The mode of the connection
michael@0 198 * (Authenticated/Encrypted)
michael@0 199 * @param[out] localPort local port used for the connection
michael@0 200 *
michael@0 201 * @return client socket descriptor
michael@0 202 * >=0: connected or in progress
michael@0 203 * INVALID SOCKET: failed
michael@0 204 *
michael@0 205 * @pre (hostAndPort not_eq NULL)
michael@0 206 * @pre (localPort not_eq NULL)
michael@0 207 *
michael@0 208 * @note localPort is undefined when the return value is INVALID_SOCKET
michael@0 209 *
michael@0 210 * @note This API maps to the HandyIron APIs as follows:
michael@0 211 * If mode == TRUE (blocking):
michael@0 212 * int secEstablishSecureConnection(const char* serverAddr, *uint32_t port, secConnectionType type)
michael@0 213 * @li ipMode is UNUSED
michael@0 214 * @li "host" maps to "serverAddr", "connectionType" maps to "type"
michael@0 215 * @li localPort is passed in as 0
michael@0 216 * If mode == FALSE (non-blocking):
michael@0 217 * int secConnect(const char* serverAddr, uint32_t port, *secConnectionType type, uint32_t localPort)
michael@0 218 * @li ipMode is UNUSED
michael@0 219 * @li "host" maps to "serverAddr", "connectionType" maps to "type"
michael@0 220 *
michael@0 221 * @note The implementation should use the "setsockopt" to set the "tos" value passed
michael@0 222 * in this API on the created socket.
michael@0 223 *
michael@0 224 */
michael@0 225 cpr_socket_t
michael@0 226 platSecSocConnect (char *host,
michael@0 227 int port,
michael@0 228 int ipMode,
michael@0 229 boolean mode,
michael@0 230 unsigned int tos,
michael@0 231 plat_soc_connect_mode_e connectionMode,
michael@0 232 uint16_t *localPort)
michael@0 233 {
michael@0 234 return 0;
michael@0 235 }
michael@0 236
michael@0 237 /**
michael@0 238 * platSecSockIsConnected
michael@0 239 * Determine the status of a secure connection that was initiated
michael@0 240 * in non-blocking mode
michael@0 241 *
michael@0 242 * @param[in] sock socket descriptor
michael@0 243 *
michael@0 244 * @return connection status
michael@0 245 * @li connection complete: PLAT_SOCK_CONN_OK
michael@0 246 * @li connection waiting: PLAT_SOCK_CONN_WAITING
michael@0 247 * @li connection failed: PLAT_SOCK_CONN_FAILED
michael@0 248 *
michael@0 249 * @note This API maps to the following HandyIron API:
michael@0 250 * int secIsConnectionReady (int connDesc)
michael@0 251 * The "sock" is the connection descriptor.
michael@0 252 */
michael@0 253 plat_soc_connect_status_e platSecSockIsConnected (cpr_socket_t sock)
michael@0 254 {
michael@0 255 return PLAT_SOCK_CONN_OK;
michael@0 256 }
michael@0 257
michael@0 258 /**
michael@0 259 * platSecSocSend
michael@0 260 *
michael@0 261 * @brief The platSecSocSend() function is used to send data over a secure
michael@0 262 * socket.
michael@0 263 *
michael@0 264 * The platSecSocSend() function shall transmit a message from the specified socket to
michael@0 265 * its peer. The platSecSocSend() function shall send a message only when the socket is
michael@0 266 * connected. The length of the message to be sent is specified by the length
michael@0 267 * argument. If the message is too long to pass through the underlying protocol,
michael@0 268 * platSecSocSend() shall fail and no data is transmitted. Delivery of the message is
michael@0 269 * not guaranteed.
michael@0 270 *
michael@0 271 * @param[in] soc Specifies the socket created with cprSocket() to send
michael@0 272 * @param[in] buf A pointer to the buffer of the message to send.
michael@0 273 * @param[in] len Specifies the length in bytes of the message pointed to by the buffer argument.
michael@0 274 *
michael@0 275 * @return Upon successful completion, platSecSocSend() shall return the number of
michael@0 276 * bytes sent. Otherwise, SOCKET_ERROR shall be returned and cpr_errno set to
michael@0 277 * indicate the error.
michael@0 278 *
michael@0 279 * @note The possible error values this function should return are
michael@0 280 * @li [CPR_EBADF] The socket argument is not a valid file descriptor
michael@0 281 * @li [CPR_ENOTSOCK] socket does not refer to a socket descriptor
michael@0 282 * @li [CPR_EAGAIN] The socket is marked non-blocking and no data can
michael@0 283 * be sent
michael@0 284 * @li [CPR_EWOULDBLOCK] Same as CPR_EAGAIN
michael@0 285 * @li [CPR_ENOTCONN] A connection-mode socket that is not connected
michael@0 286 * @li [CPR_ENOTSUPP] The specified flags are not supported for this
michael@0 287 * type of socket or protocol.
michael@0 288 * @li [CPR_EMSGSIZE] The message is too large to be sent all at once
michael@0 289 * @li [CPR_EDESTADDRREQ] The socket has no peer address set
michael@0 290 *
michael@0 291 */
michael@0 292 ssize_t
michael@0 293 platSecSocSend (cpr_socket_t soc,
michael@0 294 CONST void *buf,
michael@0 295 size_t len)
michael@0 296 {
michael@0 297 return 0;
michael@0 298 }
michael@0 299
michael@0 300 /**
michael@0 301 * platSecSocRecv
michael@0 302 *
michael@0 303 * @brief The platSecSocRecv() function shall receive a message from a secure socket.
michael@0 304 *
michael@0 305 * This function is normally used with connected sockets because it does not permit
michael@0 306 * the application to retrieve the source address of received data. The
michael@0 307 * platSecSocRecv() function shall return the length of the message written to
michael@0 308 * the buffer pointed to by the "buf" argument.
michael@0 309 *
michael@0 310 * @param[in] soc - Specifies the socket to receive data
michael@0 311 * @param[out] buf - Contains the data received
michael@0 312 * @param[out] len - The length of the data received
michael@0 313 *
michael@0 314 * @return On success the length of the message in bytes (including zero).
michael@0 315 * On failure SOCKET_ERROR shall be returned and cpr_errno set to
michael@0 316 * indicate the error.
michael@0 317 *
michael@0 318 * @note The possible error values this function should return are
michael@0 319 * @li [CPR_EBADF] The socket argument is not a valid file descriptor
michael@0 320 * @li [CPR_ENOTSOCK] The descriptor references a file, not a socket.
michael@0 321 * @li [CPR_EAGAIN] The socket is marked non-blocking and no data is
michael@0 322 * waiting to be received.
michael@0 323 * @li [CPR_EWOULDBLOCK] Same as CPR_EAGAIN
michael@0 324 * @li [CPR_ENOTCONN] A receive attempt is made on a connection-mode socket that is not connected
michael@0 325 * @li [CPR_ENOTSUPP] The specified flags are not supported for this type of socket or protocol
michael@0 326 *
michael@0 327 */
michael@0 328 ssize_t
michael@0 329 platSecSocRecv (cpr_socket_t soc,
michael@0 330 void * RESTRICT buf,
michael@0 331 size_t len)
michael@0 332 {
michael@0 333 return 0;
michael@0 334 }
michael@0 335
michael@0 336 /**
michael@0 337 * platSecSocClose
michael@0 338 *
michael@0 339 * @brief The platSecSocClose function shall close a secure socket
michael@0 340 *
michael@0 341 * The platSecSocClose() function shall destroy the socket descriptor indicated
michael@0 342 * by socket.
michael@0 343 *
michael@0 344 * @param[in] soc - The socket that needs to be destroyed
michael@0 345 *
michael@0 346 * @return CPR_SUCCESS on success otherwise, CPR_FAILURE. cpr_errno needs to be set in this case.
michael@0 347 *
michael@0 348 * @note The possible error values this function should return are
michael@0 349 * @li [CPR_EBADF] socket is not a valid socket descriptor.
michael@0 350 */
michael@0 351 cpr_status_e
michael@0 352 platSecSocClose (cpr_socket_t soc)
michael@0 353 {
michael@0 354 return CPR_SUCCESS;
michael@0 355 }
michael@0 356
michael@0 357 /**
michael@0 358 * Sets the SIS protocol version
michael@0 359 *
michael@0 360 * @param a - major version
michael@0 361 * @param b - minor version
michael@0 362 * @param c - additional version information
michael@0 363 *
michael@0 364 * @return void
michael@0 365 * @note the platform should store this information and provide it when asked via the platGetSISProtocolVer()
michael@0 366 */
michael@0 367 void platSetSISProtocolVer(uint32_t a, uint32_t b, uint32_t c, char* name)
michael@0 368 {
michael@0 369 return;
michael@0 370 }
michael@0 371
michael@0 372 /**
michael@0 373 * Provides the SIS protocol version
michael@0 374 *
michael@0 375 * @param *a pointer to fill in the major version
michael@0 376 * @param *b pointer to fill in the minor version
michael@0 377 * @param *c pointer to fill in the additonal version
michael@0 378 *
michael@0 379 * @return void
michael@0 380 */
michael@0 381 void
michael@0 382 platGetSISProtocolVer (uint32_t *a, uint32_t *b, uint32_t *c, char* name)
michael@0 383 {
michael@0 384 return;
michael@0 385 }
michael@0 386
michael@0 387
michael@0 388 void debug_bind_keyword(const char *cmd, int32_t *flag_ptr)
michael@0 389 {
michael@0 390 return;
michael@0 391 }
michael@0 392
michael@0 393 void debugif_add_keyword(const char *x, const char *y)
michael@0 394 {
michael@0 395 return;
michael@0 396 }
michael@0 397
michael@0 398 void platSetSpeakerMode(cc_boolean state)
michael@0 399 {
michael@0 400 return;
michael@0 401 }
michael@0 402
michael@0 403 boolean platGetSpeakerHeadsetMode()
michael@0 404 {
michael@0 405 return TRUE;
michael@0 406 }
michael@0 407
michael@0 408 /**
michael@0 409 * platGetFeatureAllowed
michael@0 410 *
michael@0 411 * Get whether the feature is allowed
michael@0 412 *
michael@0 413 * @param featureId - sis feature id
michael@0 414 *
michael@0 415 * @return 1 - allowed, 0 - not allowed
michael@0 416 *
michael@0 417 */
michael@0 418 int platGetFeatureAllowed(cc_sis_feature_id_e featureId)
michael@0 419 {
michael@0 420 return TRUE;
michael@0 421 }
michael@0 422
michael@0 423
michael@0 424 int platGetAudioDeviceStatus(plat_audio_device_t device_type)
michael@0 425 {
michael@0 426 return 0;
michael@0 427 }
michael@0 428
michael@0 429
michael@0 430 /*
michael@0 431 * Returns the default gateway
michael@0 432 *
michael@0 433 * @param void
michael@0 434 * @return u_long
michael@0 435 */
michael@0 436 cc_ulong_t platGetDefaultgw(){
michael@0 437 return 0;
michael@0 438 }
michael@0 439
michael@0 440 /**
michael@0 441 * Sets the time based on Date header in 200 OK from REGISTER request
michael@0 442 * @param void
michael@0 443 * @return void
michael@0 444 */
michael@0 445 void platSetCucmRegTime (void) {
michael@0 446 //Noop
michael@0 447 }
michael@0 448

mercurial