media/webrtc/signaling/src/sipcc/stub/vcm_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 /** @mainpage VCM APIs.
michael@0 6 *
michael@0 7 * @section Introduction
michael@0 8 * This module contains command APIs to the media layer
michael@0 9 */
michael@0 10
michael@0 11 /**
michael@0 12 * @file vcm.h
michael@0 13 * @brief APIs to interface with the Media layer.
michael@0 14 *
michael@0 15 * This file contains API that interface to the media layer on the platform.
michael@0 16 * The following APIs need to be implemented to have the sip stack interact
michael@0 17 * and issue commands to the media layer.
michael@0 18 */
michael@0 19
michael@0 20 #include "cpr_types.h"
michael@0 21 #include "vcm.h"
michael@0 22 #include "rtp_defs.h"
michael@0 23 #include "ccsdp.h"
michael@0 24
michael@0 25
michael@0 26 /**
michael@0 27 * The initialization of the VCM module
michael@0 28 *
michael@0 29 */
michael@0 30 void vcmInit()
michael@0 31 {
michael@0 32 return ;
michael@0 33 }
michael@0 34
michael@0 35 /**
michael@0 36 * Should we remove this from external API
michael@0 37 *
michael@0 38 * @param[in] mcap_id - group identifier to which stream belongs.
michael@0 39 * @param[in] group_id - group identifier
michael@0 40 * @param[in] cc_stream_id - stream identifier
michael@0 41 * @param[in] call_handle - call handle
michael@0 42 * @param[in] port_requested - requested port.
michael@0 43 * @param[in] listen_ip - local IP for listening
michael@0 44 * @param[in] is_multicast - multicast stream?
michael@0 45 * @param[in,out] port_allocated - allocated(reserved) port
michael@0 46 *
michael@0 47 * tbd need to see if we can deprecate this API
michael@0 48 *
michael@0 49 * @return 0 success, ERROR failure.
michael@0 50 *
michael@0 51 */
michael@0 52
michael@0 53 short vcmRxOpen(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle,
michael@0 54 uint16_t port_requested, cpr_ip_addr_t *listen_ip,
michael@0 55 boolean is_multicast, int *port_allocated)
michael@0 56 {
michael@0 57 return 0;
michael@0 58 }
michael@0 59 /*!
michael@0 60 * should we remove from external API
michael@0 61 *
michael@0 62 * @param[in] mcap_id - Media Capability ID
michael@0 63 * @param[in] group_id - group to which stream belongs
michael@0 64 * @param[in] cc_stream_id - stream identifier
michael@0 65 * @param[in] call_handle - call handle
michael@0 66 *
michael@0 67 * @return zero(0) for success otherwise, ERROR for failure
michael@0 68 *
michael@0 69 */
michael@0 70
michael@0 71 short vcmTxOpen(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle)
michael@0 72 {
michael@0 73 return 0;
michael@0 74 }
michael@0 75
michael@0 76 /*!
michael@0 77 * Allocate(Reserve) a receive port.
michael@0 78 *
michael@0 79 * @param[in] mcap_id - Media Capability ID
michael@0 80 * @param[in] group_id - group identifier to which stream belongs.
michael@0 81 * @param[in] cc_stream_id - stream identifier
michael@0 82 * @param[in] call_handle - call handle
michael@0 83 * @param[in] port_requested - port requested (if zero -> give any)
michael@0 84 * @param[out] port_allocated - port that was actually allocated.
michael@0 85 *
michael@0 86 * @return void
michael@0 87 *
michael@0 88 */
michael@0 89
michael@0 90 void vcmRxAllocPort(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handle,
michael@0 91 uint16_t port_requested, int *port_allocated)
michael@0 92 {
michael@0 93 return;
michael@0 94 }
michael@0 95
michael@0 96 /*!
michael@0 97 * Release the allocated port
michael@0 98 * @param[in] mcap_id - media capability id (0 is audio)
michael@0 99 * @param[in] group_id - group identifier
michael@0 100 * @param[in] cc_stream_id - stream identifier
michael@0 101 * @param[in] call_handle - call handle
michael@0 102 * @param[in] port - port to be released
michael@0 103 *
michael@0 104 * @return void
michael@0 105 */
michael@0 106
michael@0 107 void vcmRxReleasePort(cc_mcapid_t mcap_id, cc_groupid_t group_id,cc_streamid_t stream_id, cc_call_handle_t call_handle, int port)
michael@0 108 {
michael@0 109 return;
michael@0 110 }
michael@0 111
michael@0 112 /*!
michael@0 113 * Start receive stream
michael@0 114 * Note: For video calls, for a given call_id there will be
michael@0 115 * two media lines and the corresponding group_id/cc_stream_id pair.
michael@0 116 * One RTP session is requested from media server for each
michael@0 117 * media line(group/stream) i.e. a video call would result in
michael@0 118 * two rtp_sessions in our session info list created by two
michael@0 119 * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively.
michael@0 120 *
michael@0 121 * @param[in] mcap_id - media type id
michael@0 122 * @param[in] group_id - group identifier associated with the stream
michael@0 123 * @param[in] cc_stream_id - id of the stream one per each media line
michael@0 124 * @param[in] call_handle - call handle
michael@0 125 * @param[in] payload - payload type
michael@0 126 * @param[in] local_addr - local ip address to use.
michael@0 127 * @param[in] port - local port (receive)
michael@0 128 * @param[in] algorithmID - crypto alogrithm ID
michael@0 129 * @param[in] rx_key - rx key used when algorithm ID is encrypting
michael@0 130 * @param[in] attrs - media attributes
michael@0 131 *
michael@0 132 * @return zero(0) for success otherwise, -1 for failure
michael@0 133 *
michael@0 134 */
michael@0 135
michael@0 136 int vcmRxStart(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t
michael@0 137 stream_id, cc_call_handle_t call_handle,
michael@0 138 const vcm_payload_info_t *payload, cpr_ip_addr_t *local_addr,
michael@0 139 uint16_t port, vcm_crypto_algorithmID algorithmID,
michael@0 140 vcm_crypto_key_t *rx_key, vcm_mediaAttrs_t *attrs)
michael@0 141 {
michael@0 142 return 0;
michael@0 143 }
michael@0 144
michael@0 145 /**
michael@0 146 * start tx stream
michael@0 147 * Note: For video calls, for a given call_id there will be
michael@0 148 * two media lines and the corresponding group_id/cc_stream_id pair.
michael@0 149 * One RTP session is requested from media server for each
michael@0 150 * media line(group/stream) i.e. a video call would result in
michael@0 151 * two rtp_sessions in our session info list created by two
michael@0 152 * calls to vcm_rx/tx with mcap_id of AUDIO and VIDEO respectively.
michael@0 153 *
michael@0 154 * @param[in] mcap_id - media cap id
michael@0 155 * @param[in] group_id - group identifier to which the stream belongs
michael@0 156 * @param[in] cc_stream_id - stream id of the given media type.
michael@0 157 * @param[in] call_handle - call handle
michael@0 158 * @param[in] payload - payload type
michael@0 159 * @param[in] tos - bit marking
michael@0 160 * @param[in] local_addr - local address
michael@0 161 * @param[in] local_port - local port
michael@0 162 * @param[in] remote_ip_addr - remote ip address
michael@0 163 * @param[in] remote_port - remote port
michael@0 164 * @param[in] algorithmID - crypto alogrithm ID
michael@0 165 * @param[in] tx_key - tx key used when algorithm ID is encrypting.
michael@0 166 * @param[in] attrs - media attributes
michael@0 167 *
michael@0 168 * Returns: zero(0) for success otherwise, ERROR for failure
michael@0 169 *
michael@0 170 */
michael@0 171
michael@0 172 int vcmTxStart(cc_mcapid_t mcap_id, cc_groupid_t group_id,
michael@0 173 cc_streamid_t stream_id, cc_call_handle_t call_handle,
michael@0 174 const vcm_payload_info_t *payload, short tos,
michael@0 175 cpr_ip_addr_t *local_addr, uint16_t local_port,
michael@0 176 cpr_ip_addr_t *remote_ip_addr, uint16_t remote_port,
michael@0 177 vcm_crypto_algorithmID algorithmID, vcm_crypto_key_t *tx_key,
michael@0 178 vcm_mediaAttrs_t *attrs)
michael@0 179 {
michael@0 180 return 0;
michael@0 181 }
michael@0 182
michael@0 183 /*!
michael@0 184 * Close the receive stream.
michael@0 185 *
michael@0 186 * @param[in] mcap_id - Media Capability ID
michael@0 187 * @param[in] group_id - group identifier that belongs to the stream.
michael@0 188 * @param[in] cc_stream_id - stream id of the given media type.
michael@0 189 * @param[in] call_handle - call handle
michael@0 190 *
michael@0 191 * @return None
michael@0 192 *
michael@0 193 */
michael@0 194
michael@0 195 void vcmRxClose(cc_mcapid_t mcap_id, cc_groupid_t group_id,cc_streamid_t stream_id, cc_call_handle_t call_handle)
michael@0 196 {
michael@0 197 return;
michael@0 198 }
michael@0 199
michael@0 200 /**
michael@0 201 * Close the transmit stream
michael@0 202 *
michael@0 203 * @param[in] mcap_id - Media Capability ID
michael@0 204 * @param[in] group_id - identifier of the group to which stream belongs
michael@0 205 * @param[in] cc_stream_id - stream id of the given media type.
michael@0 206 * @param[in] call_handle - call handle
michael@0 207 *
michael@0 208 * @return void
michael@0 209 */
michael@0 210
michael@0 211 void vcmTxClose(cc_mcapid_t mcap_id, cc_groupid_t group_id, cc_streamid_t stream_id, cc_call_handle_t call_handleS)
michael@0 212 {
michael@0 213 return;
michael@0 214 }
michael@0 215
michael@0 216 /**
michael@0 217 * To be Deprecated
michael@0 218 * This may be needed to be implemented if the DSP doesn't automatically enable the side tone
michael@0 219 * The stack will make a call to this method based on the call state. Provide a stub if this is not needed.
michael@0 220 *
michael@0 221 * @param[in] side_tone - boolean to enable/disable side tone
michael@0 222 *
michael@0 223 * @return void
michael@0 224 *
michael@0 225 */
michael@0 226 void vcmEnableSidetone(uint16_t side_tone)
michael@0 227 {
michael@0 228 return;
michael@0 229 }
michael@0 230
michael@0 231 /**
michael@0 232 * Start a tone (continuous)
michael@0 233 *
michael@0 234 * Parameters:
michael@0 235 * @param[in] tone - tone type
michael@0 236 * @param[in] alert_info - alertinfo header
michael@0 237 * @param[in] call_handle - call handle
michael@0 238 * @param[in] group_id - identifier of the group to which stream belongs
michael@0 239 * @param[in] cc_stream_id - stream identifier.
michael@0 240 * @param[in] direction - network, speaker, both
michael@0 241 *
michael@0 242 * @return void
michael@0 243 *
michael@0 244 */
michael@0 245
michael@0 246 void vcmToneStart(vcm_tones_t tone, short alert_info, cc_call_handle_t call_handle, cc_groupid_t group_id,
michael@0 247 cc_streamid_t stream_id, uint16_t direction)
michael@0 248 {
michael@0 249 return;
michael@0 250 }
michael@0 251
michael@0 252 /**
michael@0 253 * Plays a short tone. uses the open audio path.
michael@0 254 * If no audio path is open, plays on speaker.
michael@0 255 *
michael@0 256 * @param[in] tone - tone type
michael@0 257 * @param[in] alert_info - alertinfo header
michael@0 258 * @param[in] call_handle - call handle
michael@0 259 * @param[in] group_id - identifier of the group to which stream belongs
michael@0 260 * @param[in] cc_stream_id - stream identifier.
michael@0 261 * @param[in] direction - network, speaker, both
michael@0 262 *
michael@0 263 * @return void
michael@0 264 */
michael@0 265
michael@0 266 void vcmToneStartWithSpeakerAsBackup(vcm_tones_t tone, short alert_info, cc_call_handle_t call_handle, cc_groupid_t group_id,
michael@0 267 cc_streamid_t stream_id, uint16_t direction)
michael@0 268 {
michael@0 269 return;
michael@0 270 }
michael@0 271
michael@0 272 /**
michael@0 273 * Stop the tone being played.
michael@0 274 *
michael@0 275 * Description: Stop the tone being played currently
michael@0 276 *
michael@0 277 *
michael@0 278 * @param[in] tone - tone to be stopeed
michael@0 279 * @param[in] group_id - associated stream's group
michael@0 280 * @param[in] cc_stream_id - associated stream id
michael@0 281 * @param[in] call_handle - the context (call) for this tone.
michael@0 282 *
michael@0 283 * @return void
michael@0 284 *
michael@0 285 */
michael@0 286
michael@0 287 void vcmToneStop(vcm_tones_t tone, cc_groupid_t group_id, cc_streamid_t cc_stream_id, cc_call_handle_t call_handle)
michael@0 288 {
michael@0 289 return;
michael@0 290 }
michael@0 291
michael@0 292 /**
michael@0 293 * start/stop ringing
michael@0 294 *
michael@0 295 * @param[in] ringMode - VCM ring mode (ON/OFF)
michael@0 296 * @param[in] once - type of ring - continuous or one shot.
michael@0 297 * @param[in] alert_info - header specified ring mode.
michael@0 298 * @param[in] line - the line on which to start/stop ringing
michael@0 299 *
michael@0 300 * @return void
michael@0 301 */
michael@0 302
michael@0 303 void vcmControlRinger(vcm_ring_mode_t ringMode, short once,
michael@0 304 boolean alert_info, int line, cc_callid_t call_id)
michael@0 305 {
michael@0 306 return;
michael@0 307 }
michael@0 308
michael@0 309
michael@0 310 /**
michael@0 311 * Enable / disable speaker
michael@0 312 *
michael@0 313 * @param[in] state - true -> enable speaker, false -> disable speaker
michael@0 314 *
michael@0 315 * @return void
michael@0 316 */
michael@0 317
michael@0 318 void vcmSetSpeakerMode(boolean state)
michael@0 319 {
michael@0 320 return;
michael@0 321 }
michael@0 322
michael@0 323 /**
michael@0 324 * Get current list of audio codec that could be used
michael@0 325 * @param request_type - sendonly/recvonly/sendrecv
michael@0 326 */
michael@0 327
michael@0 328 int vcmGetAudioCodecList(int request_type)
michael@0 329 {
michael@0 330 return 0;
michael@0 331 }
michael@0 332 /**
michael@0 333 * Get current list of video codec that could be used
michael@0 334 * @param request_type - sendonly/recvonly/sendrecv
michael@0 335 */
michael@0 336
michael@0 337 int vcmGetVideoCodecList(int request_type)
michael@0 338 {
michael@0 339 return 0;
michael@0 340 }
michael@0 341
michael@0 342 /**
michael@0 343 * Get max supported video packetization mode for H.264 video
michael@0 344 */
michael@0 345 /*
michael@0 346 int vcmGetVideoMaxSupportedPacketizationMode()
michael@0 347 {
michael@0 348 return 0;
michael@0 349 }
michael@0 350 */
michael@0 351 /**
michael@0 352 * Get the rx/tx stream statistics associated with the call.
michael@0 353 *
michael@0 354 * @param[in] mcap_id - media type (audio/video)
michael@0 355 * @param[in] group_id - group id of the stream
michael@0 356 * @param[in] cc_stream_id - stram id of the stream
michael@0 357 * @param[in] call_handle - call handle
michael@0 358 * @param[out] rx_stats - ptr to the rx field in the stats struct
michael@0 359 * @param[out] tx_stats - ptr to the tx field in the stats struct
michael@0 360 *
michael@0 361 */
michael@0 362
michael@0 363 /*
michael@0 364 int vcmGetRtpStats(cc_mcapid_t mcap_id, cc_groupid_t group_id,
michael@0 365 cc_streamid_t stream_id, cc_call_handle_t call_handle,
michael@0 366 char *rx_stats, char *tx_stats)
michael@0 367 {
michael@0 368 return 0;
michael@0 369 }
michael@0 370 */
michael@0 371
michael@0 372 /**
michael@0 373 *
michael@0 374 * The wlan interface puts into unique situation where call control
michael@0 375 * has to allocate the worst case bandwith before creating a
michael@0 376 * inbound or outbound call. The function call will interface through
michael@0 377 * media API into wlan to get the call bandwidth. The function
michael@0 378 * return is asynchronous and will block till the return media
michael@0 379 * callback signals to continue the execution.
michael@0 380 *
michael@0 381 * @note If not using WLAN interface simply return true
michael@0 382 *
michael@0 383 * @return true if the bandwidth can be allocated else false.
michael@0 384 */
michael@0 385
michael@0 386 /*
michael@0 387 boolean vcmAllocateBandwidth(cc_call_handle_t call_handle, int sessions)
michael@0 388 {
michael@0 389 return TRUE;
michael@0 390 }
michael@0 391 */
michael@0 392
michael@0 393 /**
michael@0 394 *
michael@0 395 * Free the bandwidth allocated for this call
michael@0 396 * using the vcmAllocateBandwidth API
michael@0 397 *
michael@0 398 * @note If not using WLAN provide a stub
michael@0 399 */
michael@0 400
michael@0 401 /*
michael@0 402 void vcmRemoveBandwidth(cc_call_handle_t call_handle)
michael@0 403 {
michael@0 404 return;
michael@0 405 }
michael@0 406 */
michael@0 407
michael@0 408 /**
michael@0 409 * @brief vcmActivateWlan
michael@0 410 *
michael@0 411 * Free the bandwidth allocated for this call
michael@0 412 * using the vcmAllocateBandwidth API
michael@0 413 *
michael@0 414 * @note If not using WLAN provide a stub
michael@0 415 */
michael@0 416
michael@0 417 /*
michael@0 418 void vcmActivateWlan(boolean is_active)
michael@0 419 {
michael@0 420 return;
michael@0 421 }
michael@0 422 */
michael@0 423
michael@0 424 /**
michael@0 425 * free the media pointer allocated in vcm_negotiate_attrs method
michael@0 426 *
michael@0 427 * @param ptr - pointer to be freed
michael@0 428 *
michael@0 429 * @return void
michael@0 430 */
michael@0 431 void vcmFreeMediaPtr(void *ptr)
michael@0 432 {
michael@0 433 return;
michael@0 434 }
michael@0 435
michael@0 436 /**
michael@0 437 * MEDIA control received from far end on signaling path
michael@0 438 *
michael@0 439 * @param call_handle - call handle of the call
michael@0 440 * @param to_encoder - the control request received
michael@0 441 * Only FAST_PICTURE_UPDATE is supported
michael@0 442 *
michael@0 443 * @return void
michael@0 444 *
michael@0 445 */
michael@0 446
michael@0 447 /*
michael@0 448 void vcmMediaControl(cc_call_handle_t call_handle, vcm_media_control_to_encoder_t to_encoder)
michael@0 449 {
michael@0 450 return;
michael@0 451 }
michael@0 452 */
michael@0 453
michael@0 454 /**
michael@0 455 * specifies DSCP marking for RTCP streams
michael@0 456 *
michael@0 457 * @param group_id - call_id of the call
michael@0 458 * @param dscp - the DSCP value to be used
michael@0 459 *
michael@0 460 * @return void
michael@0 461 */
michael@0 462
michael@0 463 /*
michael@0 464 void vcmSetRtcpDscp(cc_groupid_t group_id, int dscp)
michael@0 465 {
michael@0 466 return;
michael@0 467 }
michael@0 468 */
michael@0 469
michael@0 470 /**
michael@0 471 * Verify if the SDP attributes for the requested video codec are acceptable
michael@0 472 *
michael@0 473 * This method is called for video codecs only. This method should parse the
michael@0 474 * Video SDP attributes using the SDP helper API and verify if received
michael@0 475 * attributes are acceptable. If the attributes are acceptable any attribute
michael@0 476 * values if needed by vcmTxStart method should be bundled in the desired
michael@0 477 * structure and its pointer should be returned in rccappptr. This opaque
michael@0 478 * pointer shall be provided again when vcmTxStart is invoked.
michael@0 479 *
michael@0 480 * @param [in] media_type - codec for which we are negotiating
michael@0 481 * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs
michael@0 482 * @param [in] level - Parameter to be used with SDP helper APIs
michael@0 483 * @param [out] rcapptr - variable to return the allocated attrib structure
michael@0 484 *
michael@0 485 * @return boolean - true if attributes are accepted false otherwise
michael@0 486 */
michael@0 487
michael@0 488 boolean vcmCheckAttribs(uint32_t media_type, void *sdp_p, int level, void **rcapptr)
michael@0 489 {
michael@0 490 return TRUE;
michael@0 491 }
michael@0 492
michael@0 493 /**
michael@0 494 * Add Video attributes in the offer/answer SDP
michael@0 495 *
michael@0 496 * This method is called for video codecs only. This method should populate the
michael@0 497 * Video SDP attributes using the SDP helper API
michael@0 498 *
michael@0 499 * @param [in] sdp_p - opaque SDP pointer to be used via SDP helper APIs
michael@0 500 * @param [in] level - Parameter to be used with SDP helper APIs
michael@0 501 * @param [in] media_type - codec for which the SDP attributes are to be populated
michael@0 502 * @param [in] payload_number - RTP payload type used for the SDP
michael@0 503 * @param [in] isOffer - boolean indicating we are encoding an offer or an aswer
michael@0 504 *
michael@0 505 * @return void
michael@0 506 */
michael@0 507
michael@0 508
michael@0 509 void vcmPopulateAttribs(void *sdp_p, int level, uint32_t media_type,
michael@0 510 uint16_t payload_number, boolean isOffer)
michael@0 511 {
michael@0 512 return;
michael@0 513 }
michael@0 514
michael@0 515 /**
michael@0 516 * Send a DTMF digit
michael@0 517 *
michael@0 518 * This method is called for sending a DTMF tone for the specified duration
michael@0 519 *
michael@0 520 * @param [in] digit - the DTMF digit that needs to be played out.
michael@0 521 * @param [in] duration - duration of the tone
michael@0 522 * @param [in] direction - direction in which the tone needs to be played.
michael@0 523 *
michael@0 524 * @return void
michael@0 525 */
michael@0 526
michael@0 527 /*
michael@0 528 int vcmDtmfBurst(int digit, int duration, int direction)
michael@0 529 {
michael@0 530 return 0;
michael@0 531 }
michael@0 532 */
michael@0 533
michael@0 534 /*
michael@0 535 int vcmGetILBCMode()
michael@0 536 {
michael@0 537 return SIPSDP_ILBC_MODE20;
michael@0 538 }
michael@0 539 */

mercurial