OLD | NEW |
(Empty) | |
| 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.h" |
| 64 |
| 65 typedef struct rtp_sender_ctx_t *rtp_sender_t; |
| 66 |
| 67 typedef struct rtp_receiver_ctx_t *rtp_receiver_t; |
| 68 |
| 69 int |
| 70 rtp_sendto(rtp_sender_t sender, const void* msg, int len); |
| 71 |
| 72 int |
| 73 rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len); |
| 74 |
| 75 int |
| 76 rtp_receiver_init(rtp_receiver_t rcvr, int sock, |
| 77 struct sockaddr_in addr, unsigned int ssrc); |
| 78 |
| 79 int |
| 80 rtp_sender_init(rtp_sender_t sender, int sock, |
| 81 struct sockaddr_in addr, unsigned int ssrc); |
| 82 |
| 83 /* |
| 84 * srtp_sender_init(...) initializes an rtp_sender_t |
| 85 */ |
| 86 |
| 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 ); |
| 93 |
| 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 ); |
| 100 |
| 101 |
| 102 int |
| 103 rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy); |
| 104 |
| 105 int |
| 106 rtp_sender_deinit_srtp(rtp_sender_t sender); |
| 107 |
| 108 int |
| 109 rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy); |
| 110 |
| 111 int |
| 112 rtp_receiver_deinit_srtp(rtp_receiver_t sender); |
| 113 |
| 114 |
| 115 rtp_sender_t |
| 116 rtp_sender_alloc(void); |
| 117 |
| 118 void |
| 119 rtp_sender_dealloc(rtp_sender_t rtp_ctx); |
| 120 |
| 121 rtp_receiver_t |
| 122 rtp_receiver_alloc(void); |
| 123 |
| 124 void |
| 125 rtp_receiver_dealloc(rtp_receiver_t rtp_ctx); |
| 126 |
| 127 |
| 128 /* |
| 129 * RTP_HEADER_LEN indicates the size of an RTP header |
| 130 */ |
| 131 #define RTP_HEADER_LEN 12 |
| 132 |
| 133 /* |
| 134 * RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementation |
| 135 */ |
| 136 #define RTP_MAX_BUF_LEN 16384 |
| 137 |
| 138 |
| 139 #endif /* RTP_H */ |
OLD | NEW |