webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
rtp.h
Go to the documentation of this file.
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  */
16 
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  */
52 
53 
54 #ifndef RTP_H
55 #define RTP_H
56 
57 #ifdef HAVE_NETINET_IN_H
58 # include <netinet/in.h>
59 #elif defined HAVE_WINSOCK2_H
60 # include <winsock2.h>
61 #endif
62 
63 //#include "srtp_priv.h"
64 #include "srtp.h"
65 
66 #ifdef __cplusplus
67 extern "C" {
68 #endif
69 
70 /*
71  * RTP_HEADER_LEN indicates the size of an RTP header
72  */
73 #define RTP_HEADER_LEN 12
74 
75 /*
76  * RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementation
77  */
78 #define RTP_MAX_BUF_LEN 16384
79 
80 
82 
83 typedef struct {
86 } rtp_msg_t;
87 
88 typedef struct rtp_sender_ctx_t {
90  int socket;
92  struct sockaddr_in addr; /* reciever's address */
94 
95 typedef struct rtp_receiver_ctx_t {
97  int socket;
99  struct sockaddr_in addr; /* receiver's address */
101 
102 
103 typedef struct rtp_sender_ctx_t *rtp_sender_t;
104 
105 typedef struct rtp_receiver_ctx_t *rtp_receiver_t;
106 
107 int
108 rtp_sendto(rtp_sender_t sender, const void* msg, int len);
109 
110 int
111 rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len);
112 
113 int
114 rtp_receiver_init(rtp_receiver_t rcvr, int sock,
115  struct sockaddr_in addr, unsigned int ssrc);
116 
117 int
118 rtp_sender_init(rtp_sender_t sender, int sock,
119  struct sockaddr_in addr, unsigned int ssrc);
120 
121 /*
122  * srtp_sender_init(...) initializes an rtp_sender_t
123  */
124 
125 int
126 srtp_sender_init(rtp_sender_t rtp_ctx, /* structure to be init'ed */
127  struct sockaddr_in name, /* socket name */
128  srtp_sec_serv_t security_services, /* sec. servs. to be used */
129  unsigned char *input_key /* master key/salt in hex */
130  );
131 
132 int
133 srtp_receiver_init(rtp_receiver_t rtp_ctx, /* structure to be init'ed */
134  struct sockaddr_in name, /* socket name */
135  srtp_sec_serv_t security_services, /* sec. servs. to be used */
136  unsigned char *input_key /* master key/salt in hex */
137  );
138 
139 
140 int
141 rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy);
142 
143 int
144 rtp_sender_deinit_srtp(rtp_sender_t sender);
145 
146 int
147 rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy);
148 
149 int
150 rtp_receiver_deinit_srtp(rtp_receiver_t sender);
151 
152 
153 rtp_sender_t
154 rtp_sender_alloc(void);
155 
156 void
157 rtp_sender_dealloc(rtp_sender_t rtp_ctx);
158 
159 rtp_receiver_t
160 rtp_receiver_alloc(void);
161 
162 void
163 rtp_receiver_dealloc(rtp_receiver_t rtp_ctx);
164 
165 
166 #ifdef __cplusplus
167 }
168 #endif
169 
170 #endif /* RTP_H */
Definition: srtp_priv.h:135
Definition: rtp.h:83
DOMString body
Definition: Notification.idl:65
Definition: rtp.h:88
Definition: rtpw.c:144
int srtp_receiver_init(rtp_receiver_t rtp_ctx, struct sockaddr_in name, srtp_sec_serv_t security_services, unsigned char *input_key)
struct rtp_sender_ctx_t rtp_sender_ctx_t
Definition: rtp.h:95
int socket
Definition: rtp.h:97
struct sockaddr_in addr
Definition: rtp.h:92
rtp_msg_t message
Definition: rtp.h:96
OPENSSL_EXPORT const ASN1_OBJECT int const unsigned char int len
Definition: x509.h:1053
srtp_ctx_t * srtp_ctx
Definition: rtp.h:98
int rtp_sender_init(rtp_sender_t sender, int sock, struct sockaddr_in addr, unsigned int ssrc)
Definition: rtp.c:142
int rtp_sendto(rtp_sender_t sender, const void *msg, int len)
Definition: rtp.c:60
Definition: srtp.h:119
EGLImageKHR EGLint * name
Definition: eglext.h:851
srtp_ctx_t * srtp_ctx
Definition: rtp.h:91
Definition: rtpw.c:144
int rtp_receiver_init(rtp_receiver_t rcvr, int sock, struct sockaddr_in addr, unsigned int ssrc)
Definition: rtp.c:166
struct rtp_sender_ctx_t * rtp_sender_t
Definition: rtp.h:103
int srtp_sender_init(rtp_sender_t rtp_ctx, struct sockaddr_in name, srtp_sec_serv_t security_services, unsigned char *input_key)
rtp_msg_t message
Definition: rtp.h:89
int rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len)
Definition: rtp.c:100
srtp_hdr_t header
Definition: rtp.h:84
rtp_sender_t rtp_sender_alloc(void)
Definition: rtp.c:210
void rtp_receiver_dealloc(rtp_receiver_t rtp_ctx)
Definition: rtp.c:225
srtp_sec_serv_t
srtp_sec_serv_t describes a set of security services.
Definition: srtp.h:289
represents the policy for an SRTP session.
Definition: srtp.h:395
rtp_receiver_t rtp_receiver_alloc(void)
Definition: rtp.c:220
srtp_hdr_t rtp_hdr_t
Definition: rtp.h:81
struct rtp_receiver_ctx_t * rtp_receiver_t
Definition: rtp.h:105
struct rtp_receiver_ctx_t rtp_receiver_ctx_t
int rtp_receiver_deinit_srtp(rtp_receiver_t sender)
Definition: rtp.c:205
void rtp_sender_dealloc(rtp_sender_t rtp_ctx)
Definition: rtp.c:215
int rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy)
Definition: rtp.c:190
#define RTP_MAX_BUF_LEN
Definition: rtp.h:78
int socket
Definition: rtp.h:90
int rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy)
Definition: rtp.c:200
int rtp_sender_deinit_srtp(rtp_sender_t sender)
Definition: rtp.c:195