| OLD | NEW |
| 1 /* | 1 /* |
| 2 * rtp_priv.h | 2 * rtp_decoder.h |
| 3 * | 3 * |
| 4 * private, internal header file for RTP | 4 * decoder structures and functions for SRTP pcap decoder |
| 5 * | 5 * |
| 6 * David A. McGrew | 6 * Bernardo Torres <bernardo@torresautomacao.com.br> |
| 7 * Cisco Systems, Inc. | 7 * |
| 8 * Some structure and code from https://github.com/gteissier/srtp-decrypt |
| 9 * |
| 8 */ | 10 */ |
| 9 /* | 11 /* |
| 10 * | 12 * |
| 11 * Copyright (c) 2001-2006 Cisco Systems, Inc. | 13 * Copyright (c) 2001-2006 Cisco Systems, Inc. |
| 12 * All rights reserved. | 14 * All rights reserved. |
| 13 * | 15 * |
| 14 * Redistribution and use in source and binary forms, with or without | 16 * Redistribution and use in source and binary forms, with or without |
| 15 * modification, are permitted provided that the following conditions | 17 * modification, are permitted provided that the following conditions |
| 16 * are met: | 18 * are met: |
| 17 * | 19 * |
| (...skipping 18 matching lines...) Expand all Loading... |
| 36 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 37 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 39 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 38 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, | 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 39 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 40 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED | 42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 41 * OF THE POSSIBILITY OF SUCH DAMAGE. | 43 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 42 * | 44 * |
| 43 */ | 45 */ |
| 44 | 46 |
| 45 | 47 |
| 46 #ifndef RTP_PRIV_H | 48 #ifndef RTP_DECODER_H |
| 47 #define RTP_PRIV_H | 49 #define RTP_DECODER_H |
| 48 | 50 |
| 49 #include "srtp_priv.h" | 51 #include "srtp_priv.h" |
| 52 #include "rtp_priv.h" |
| 50 #include "rtp.h" | 53 #include "rtp.h" |
| 54 #include "datatypes.h" |
| 51 | 55 |
| 52 typedef srtp_hdr_t rtp_hdr_t; | 56 #define DEFAULT_RTP_OFFSET 42 |
| 53 | 57 |
| 54 typedef struct { | 58 typedef struct rtp_decoder_ctx_t { |
| 55 srtp_hdr_t header; | 59 srtp_policy_t policy; |
| 56 char body[RTP_MAX_BUF_LEN]; | 60 srtp_ctx_t *srtp_ctx; |
| 57 } rtp_msg_t; | 61 int rtp_offset; |
| 62 struct timeval start_tv; |
| 63 int frame_nr; |
| 64 rtp_msg_t message; |
| 65 } rtp_decoder_ctx_t; |
| 58 | 66 |
| 59 typedef struct rtp_sender_ctx_t { | 67 typedef struct rtp_decoder_ctx_t *rtp_decoder_t; |
| 60 rtp_msg_t message; | |
| 61 int socket; | |
| 62 srtp_ctx_t *srtp_ctx; | |
| 63 struct sockaddr_in addr; /* reciever's address */ | |
| 64 } rtp_sender_ctx_t; | |
| 65 | 68 |
| 66 typedef struct rtp_receiver_ctx_t { | 69 /* |
| 67 rtp_msg_t message; | 70 * error to string |
| 68 int socket; | 71 */ |
| 69 srtp_ctx_t *srtp_ctx; | |
| 70 struct sockaddr_in addr; /* receiver's address */ | |
| 71 } rtp_receiver_ctx_t; | |
| 72 | 72 |
| 73 void rtp_print_error(err_status_t status, char *message); |
| 73 | 74 |
| 74 #endif /* RTP_PRIV_H */ | 75 /* |
| 76 * prints the output of a random buffer in hexadecimal |
| 77 */ |
| 78 |
| 79 void |
| 80 hexdump(const void *ptr, size_t size); |
| 81 |
| 82 /* |
| 83 * the function usage() prints an error message describing how this |
| 84 * program should be called, then calls exit() |
| 85 */ |
| 86 |
| 87 void |
| 88 usage(char *prog_name); |
| 89 |
| 90 /* |
| 91 * transforms base64 key into octet |
| 92 */ |
| 93 |
| 94 char *decode_sdes(char *in, char *out); |
| 95 |
| 96 /* |
| 97 * pcap handling |
| 98 */ |
| 99 |
| 100 void |
| 101 rtp_decoder_handle_pkt(u_char *arg, const struct pcap_pkthdr *hdr, |
| 102 » const u_char *bytes); |
| 103 |
| 104 rtp_decoder_t |
| 105 rtp_decoder_alloc(void); |
| 106 |
| 107 void |
| 108 rtp_decoder_dealloc(rtp_decoder_t rtp_ctx); |
| 109 |
| 110 int |
| 111 rtp_decoder_init(rtp_decoder_t dcdr, srtp_policy_t policy); |
| 112 |
| 113 err_status_t |
| 114 rtp_decoder_init_srtp(rtp_decoder_t decoder, unsigned int ssrc); |
| 115 |
| 116 int |
| 117 rtp_decoder_deinit_srtp(rtp_decoder_t decoder); |
| 118 |
| 119 #endif /* RTP_DECODER_H */ |
| OLD | NEW |