Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /*
2 * rtp.h
3 *
4 * rtp interface for srtp reference implementation
5 *
6 * David A. McGrew
7 * Cisco Systems, Inc.
8 *
9 * data types:
10 *
11 * rtp_msg_t an rtp message (the data that goes on the wire)
12 * rtp_sender_t sender side socket and rtp info
13 * rtp_receiver_t receiver side socket and rtp info
14 *
15 */
17 /*
18 *
19 * Copyright (c) 2001-2006, Cisco Systems, Inc.
20 * All rights reserved.
21 *
22 * Redistribution and use in source and binary forms, with or without
23 * modification, are permitted provided that the following conditions
24 * are met:
25 *
26 * Redistributions of source code must retain the above copyright
27 * notice, this list of conditions and the following disclaimer.
28 *
29 * Redistributions in binary form must reproduce the above
30 * copyright notice, this list of conditions and the following
31 * disclaimer in the documentation and/or other materials provided
32 * with the distribution.
33 *
34 * Neither the name of the Cisco Systems, Inc. nor the names of its
35 * contributors may be used to endorse or promote products derived
36 * from this software without specific prior written permission.
37 *
38 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
39 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
40 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
41 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
42 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
43 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
44 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
45 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
46 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
47 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
48 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
49 * OF THE POSSIBILITY OF SUCH DAMAGE.
50 *
51 */
54 #ifndef RTP_H
55 #define RTP_H
57 #ifdef HAVE_NETINET_IN_H
58 # include <netinet/in.h>
59 #elif defined HAVE_WINSOCK2_H
60 # include <winsock2.h>
61 #endif
63 #include "srtp.h"
65 typedef struct rtp_sender_ctx_t *rtp_sender_t;
67 typedef struct rtp_receiver_ctx_t *rtp_receiver_t;
69 int
70 rtp_sendto(rtp_sender_t sender, const void* msg, int len);
72 int
73 rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len);
75 int
76 rtp_receiver_init(rtp_receiver_t rcvr, int sock,
77 struct sockaddr_in addr, unsigned int ssrc);
79 int
80 rtp_sender_init(rtp_sender_t sender, int sock,
81 struct sockaddr_in addr, unsigned int ssrc);
83 /*
84 * srtp_sender_init(...) initializes an rtp_sender_t
85 */
87 int
88 srtp_sender_init(rtp_sender_t rtp_ctx, /* structure to be init'ed */
89 struct sockaddr_in name, /* socket name */
90 sec_serv_t security_services, /* sec. servs. to be used */
91 unsigned char *input_key /* master key/salt in hex */
92 );
94 int
95 srtp_receiver_init(rtp_receiver_t rtp_ctx, /* structure to be init'ed */
96 struct sockaddr_in name, /* socket name */
97 sec_serv_t security_services, /* sec. servs. to be used */
98 unsigned char *input_key /* master key/salt in hex */
99 );
102 int
103 rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy);
105 int
106 rtp_sender_deinit_srtp(rtp_sender_t sender);
108 int
109 rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy);
111 int
112 rtp_receiver_deinit_srtp(rtp_receiver_t sender);
115 rtp_sender_t
116 rtp_sender_alloc(void);
118 void
119 rtp_sender_dealloc(rtp_sender_t rtp_ctx);
121 rtp_receiver_t
122 rtp_receiver_alloc(void);
124 void
125 rtp_receiver_dealloc(rtp_receiver_t rtp_ctx);
128 /*
129 * RTP_HEADER_LEN indicates the size of an RTP header
130 */
131 #define RTP_HEADER_LEN 12
133 /*
134 * RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementation
135 */
136 #define RTP_MAX_BUF_LEN 16384
139 #endif /* RTP_H */