1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/netwerk/srtp/src/include/rtp.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,139 @@ 1.4 +/* 1.5 + * rtp.h 1.6 + * 1.7 + * rtp interface for srtp reference implementation 1.8 + * 1.9 + * David A. McGrew 1.10 + * Cisco Systems, Inc. 1.11 + * 1.12 + * data types: 1.13 + * 1.14 + * rtp_msg_t an rtp message (the data that goes on the wire) 1.15 + * rtp_sender_t sender side socket and rtp info 1.16 + * rtp_receiver_t receiver side socket and rtp info 1.17 + * 1.18 + */ 1.19 + 1.20 +/* 1.21 + * 1.22 + * Copyright (c) 2001-2006, Cisco Systems, Inc. 1.23 + * All rights reserved. 1.24 + * 1.25 + * Redistribution and use in source and binary forms, with or without 1.26 + * modification, are permitted provided that the following conditions 1.27 + * are met: 1.28 + * 1.29 + * Redistributions of source code must retain the above copyright 1.30 + * notice, this list of conditions and the following disclaimer. 1.31 + * 1.32 + * Redistributions in binary form must reproduce the above 1.33 + * copyright notice, this list of conditions and the following 1.34 + * disclaimer in the documentation and/or other materials provided 1.35 + * with the distribution. 1.36 + * 1.37 + * Neither the name of the Cisco Systems, Inc. nor the names of its 1.38 + * contributors may be used to endorse or promote products derived 1.39 + * from this software without specific prior written permission. 1.40 + * 1.41 + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 1.42 + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 1.43 + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 1.44 + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 1.45 + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 1.46 + * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 1.47 + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 1.48 + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 1.49 + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, 1.50 + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 1.51 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED 1.52 + * OF THE POSSIBILITY OF SUCH DAMAGE. 1.53 + * 1.54 + */ 1.55 + 1.56 + 1.57 +#ifndef RTP_H 1.58 +#define RTP_H 1.59 + 1.60 +#ifdef HAVE_NETINET_IN_H 1.61 +# include <netinet/in.h> 1.62 +#elif defined HAVE_WINSOCK2_H 1.63 +# include <winsock2.h> 1.64 +#endif 1.65 + 1.66 +#include "srtp.h" 1.67 + 1.68 +typedef struct rtp_sender_ctx_t *rtp_sender_t; 1.69 + 1.70 +typedef struct rtp_receiver_ctx_t *rtp_receiver_t; 1.71 + 1.72 +int 1.73 +rtp_sendto(rtp_sender_t sender, const void* msg, int len); 1.74 + 1.75 +int 1.76 +rtp_recvfrom(rtp_receiver_t receiver, void *msg, int *len); 1.77 + 1.78 +int 1.79 +rtp_receiver_init(rtp_receiver_t rcvr, int sock, 1.80 + struct sockaddr_in addr, unsigned int ssrc); 1.81 + 1.82 +int 1.83 +rtp_sender_init(rtp_sender_t sender, int sock, 1.84 + struct sockaddr_in addr, unsigned int ssrc); 1.85 + 1.86 +/* 1.87 + * srtp_sender_init(...) initializes an rtp_sender_t 1.88 + */ 1.89 + 1.90 +int 1.91 +srtp_sender_init(rtp_sender_t rtp_ctx, /* structure to be init'ed */ 1.92 + struct sockaddr_in name, /* socket name */ 1.93 + sec_serv_t security_services, /* sec. servs. to be used */ 1.94 + unsigned char *input_key /* master key/salt in hex */ 1.95 + ); 1.96 + 1.97 +int 1.98 +srtp_receiver_init(rtp_receiver_t rtp_ctx, /* structure to be init'ed */ 1.99 + struct sockaddr_in name, /* socket name */ 1.100 + sec_serv_t security_services, /* sec. servs. to be used */ 1.101 + unsigned char *input_key /* master key/salt in hex */ 1.102 + ); 1.103 + 1.104 + 1.105 +int 1.106 +rtp_sender_init_srtp(rtp_sender_t sender, const srtp_policy_t *policy); 1.107 + 1.108 +int 1.109 +rtp_sender_deinit_srtp(rtp_sender_t sender); 1.110 + 1.111 +int 1.112 +rtp_receiver_init_srtp(rtp_receiver_t sender, const srtp_policy_t *policy); 1.113 + 1.114 +int 1.115 +rtp_receiver_deinit_srtp(rtp_receiver_t sender); 1.116 + 1.117 + 1.118 +rtp_sender_t 1.119 +rtp_sender_alloc(void); 1.120 + 1.121 +void 1.122 +rtp_sender_dealloc(rtp_sender_t rtp_ctx); 1.123 + 1.124 +rtp_receiver_t 1.125 +rtp_receiver_alloc(void); 1.126 + 1.127 +void 1.128 +rtp_receiver_dealloc(rtp_receiver_t rtp_ctx); 1.129 + 1.130 + 1.131 +/* 1.132 + * RTP_HEADER_LEN indicates the size of an RTP header 1.133 + */ 1.134 +#define RTP_HEADER_LEN 12 1.135 + 1.136 +/* 1.137 + * RTP_MAX_BUF_LEN defines the largest RTP packet in the rtp.c implementation 1.138 + */ 1.139 +#define RTP_MAX_BUF_LEN 16384 1.140 + 1.141 + 1.142 +#endif /* RTP_H */