Index: srtp/test/rtp_decoder.h |
diff --git a/srtp/include/rtp_priv.h b/srtp/test/rtp_decoder.h |
similarity index 55% |
copy from srtp/include/rtp_priv.h |
copy to srtp/test/rtp_decoder.h |
index 142138667337781c2d472045afe8a86a55abb5f4..3a92d8aaea237cbf4bea629dd63827b1ac69f8c7 100644 |
--- a/srtp/include/rtp_priv.h |
+++ b/srtp/test/rtp_decoder.h |
@@ -1,10 +1,12 @@ |
/* |
- * rtp_priv.h |
+ * rtp_decoder.h |
* |
- * private, internal header file for RTP |
+ * decoder structures and functions for SRTP pcap decoder |
+ * |
+ * Bernardo Torres <bernardo@torresautomacao.com.br> |
+ * |
+ * Some structure and code from https://github.com/gteissier/srtp-decrypt |
* |
- * David A. McGrew |
- * Cisco Systems, Inc. |
*/ |
/* |
* |
@@ -43,32 +45,75 @@ |
*/ |
-#ifndef RTP_PRIV_H |
-#define RTP_PRIV_H |
+#ifndef RTP_DECODER_H |
+#define RTP_DECODER_H |
#include "srtp_priv.h" |
+#include "rtp_priv.h" |
#include "rtp.h" |
+#include "datatypes.h" |
-typedef srtp_hdr_t rtp_hdr_t; |
+#define DEFAULT_RTP_OFFSET 42 |
-typedef struct { |
- srtp_hdr_t header; |
- char body[RTP_MAX_BUF_LEN]; |
-} rtp_msg_t; |
- |
-typedef struct rtp_sender_ctx_t { |
- rtp_msg_t message; |
- int socket; |
+typedef struct rtp_decoder_ctx_t { |
+ srtp_policy_t policy; |
srtp_ctx_t *srtp_ctx; |
- struct sockaddr_in addr; /* reciever's address */ |
-} rtp_sender_ctx_t; |
- |
-typedef struct rtp_receiver_ctx_t { |
+ int rtp_offset; |
+ struct timeval start_tv; |
+ int frame_nr; |
rtp_msg_t message; |
- int socket; |
- srtp_ctx_t *srtp_ctx; |
- struct sockaddr_in addr; /* receiver's address */ |
-} rtp_receiver_ctx_t; |
+} rtp_decoder_ctx_t; |
+ |
+typedef struct rtp_decoder_ctx_t *rtp_decoder_t; |
+ |
+/* |
+ * error to string |
+ */ |
+ |
+void rtp_print_error(err_status_t status, char *message); |
+ |
+/* |
+ * prints the output of a random buffer in hexadecimal |
+ */ |
+ |
+void |
+hexdump(const void *ptr, size_t size); |
+ |
+/* |
+ * the function usage() prints an error message describing how this |
+ * program should be called, then calls exit() |
+ */ |
+ |
+void |
+usage(char *prog_name); |
+ |
+/* |
+ * transforms base64 key into octet |
+ */ |
+ |
+char *decode_sdes(char *in, char *out); |
+ |
+/* |
+ * pcap handling |
+ */ |
+ |
+void |
+rtp_decoder_handle_pkt(u_char *arg, const struct pcap_pkthdr *hdr, |
+ const u_char *bytes); |
+ |
+rtp_decoder_t |
+rtp_decoder_alloc(void); |
+ |
+void |
+rtp_decoder_dealloc(rtp_decoder_t rtp_ctx); |
+ |
+int |
+rtp_decoder_init(rtp_decoder_t dcdr, srtp_policy_t policy); |
+ |
+err_status_t |
+rtp_decoder_init_srtp(rtp_decoder_t decoder, unsigned int ssrc); |
+int |
+rtp_decoder_deinit_srtp(rtp_decoder_t decoder); |
-#endif /* RTP_PRIV_H */ |
+#endif /* RTP_DECODER_H */ |