OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * rtp_decoder.h |
| 3 * |
| 4 * decoder structures and functions for SRTP pcap decoder |
| 5 * |
| 6 * Bernardo Torres <bernardo@torresautomacao.com.br> |
| 7 * |
| 8 * Some structure and code from https://github.com/gteissier/srtp-decrypt |
| 9 * |
| 10 */ |
| 11 /* |
| 12 * |
| 13 * Copyright (c) 2001-2006 Cisco Systems, Inc. |
| 14 * All rights reserved. |
| 15 * |
| 16 * Redistribution and use in source and binary forms, with or without |
| 17 * modification, are permitted provided that the following conditions |
| 18 * are met: |
| 19 * |
| 20 * Redistributions of source code must retain the above copyright |
| 21 * notice, this list of conditions and the following disclaimer. |
| 22 * |
| 23 * Redistributions in binary form must reproduce the above |
| 24 * copyright notice, this list of conditions and the following |
| 25 * disclaimer in the documentation and/or other materials provided |
| 26 * with the distribution. |
| 27 * |
| 28 * Neither the name of the Cisco Systems, Inc. nor the names of its |
| 29 * contributors may be used to endorse or promote products derived |
| 30 * from this software without specific prior written permission. |
| 31 * |
| 32 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 33 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 34 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS |
| 35 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE |
| 36 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, |
| 37 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 38 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 39 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 40 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, |
| 41 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 42 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED |
| 43 * OF THE POSSIBILITY OF SUCH DAMAGE. |
| 44 * |
| 45 */ |
| 46 |
| 47 |
| 48 #ifndef RTP_DECODER_H |
| 49 #define RTP_DECODER_H |
| 50 |
| 51 #include "srtp_priv.h" |
| 52 #include "rtp_priv.h" |
| 53 #include "rtp.h" |
| 54 #include "datatypes.h" |
| 55 |
| 56 #define DEFAULT_RTP_OFFSET 42 |
| 57 |
| 58 typedef struct rtp_decoder_ctx_t { |
| 59 srtp_policy_t policy; |
| 60 srtp_ctx_t *srtp_ctx; |
| 61 int rtp_offset; |
| 62 struct timeval start_tv; |
| 63 int frame_nr; |
| 64 rtp_msg_t message; |
| 65 } rtp_decoder_ctx_t; |
| 66 |
| 67 typedef struct rtp_decoder_ctx_t *rtp_decoder_t; |
| 68 |
| 69 /* |
| 70 * error to string |
| 71 */ |
| 72 |
| 73 void rtp_print_error(err_status_t status, char *message); |
| 74 |
| 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 |