oRTP  0.24.0
event.h
1  /*
2  The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack.
3  Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org
4 
5  This library is free software; you can redistribute it and/or
6  modify it under the terms of the GNU Lesser General Public
7  License as published by the Free Software Foundation; either
8  version 2.1 of the License, or (at your option) any later version.
9 
10  This library is distributed in the hope that it will be useful,
11  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Lesser General Public License for more details.
14 
15  You should have received a copy of the GNU Lesser General Public
16  License along with this library; if not, write to the Free Software
17  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 */
19 
20 #ifndef ortp_events_h
21 #define ortp_events_h
22 
23 #include <ortp/str_utils.h>
24 
25 typedef mblk_t OrtpEvent;
26 
27 typedef unsigned long OrtpEventType;
28 
29 typedef enum {
30  OrtpRTPSocket,
31  OrtpRTCPSocket
32 } OrtpSocketType;
33 
35  mblk_t *packet; /* most events are associated to a received packet */
36  struct sockaddr_storage source_addr;
37  socklen_t source_addrlen;
38  ortpTimeSpec ts;
39  union {
40  int telephone_event;
41  int payload_type;
42  bool_t dtls_stream_encrypted;
43  bool_t zrtp_stream_encrypted;
44  struct _ZrtpSas{
45  char sas[5]; // 4 characters
46  bool_t verified;
47  } zrtp_sas;
48  OrtpSocketType socket_type;
49  bool_t ice_processing_successful;
50  uint64_t tmmbr_mxtbr;
51  } info;
52 };
53 
54 typedef struct _OrtpEventData OrtpEventData;
55 
56 
57 
58 #ifdef __cplusplus
59 extern "C"{
60 #endif
61 
62 ORTP_PUBLIC OrtpEvent * ortp_event_new(OrtpEventType tp);
63 ORTP_PUBLIC OrtpEventType ortp_event_get_type(const OrtpEvent *ev);
64 /* type is one of the following*/
65 #define ORTP_EVENT_STUN_PACKET_RECEIVED 1
66 #define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2
67 #define ORTP_EVENT_TELEPHONE_EVENT 3
68 #define ORTP_EVENT_RTCP_PACKET_RECEIVED 4
69 #define ORTP_EVENT_RTCP_PACKET_EMITTED 5
70 #define ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED 6
71 #define ORTP_EVENT_ZRTP_SAS_READY 7
72 #define ORTP_EVENT_ICE_CHECK_LIST_PROCESSING_FINISHED 8
73 #define ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED 9
74 #define ORTP_EVENT_ICE_GATHERING_FINISHED 10
75 #define ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED 11
76 #define ORTP_EVENT_ICE_RESTART_NEEDED 12
77 #define ORTP_EVENT_DTLS_ENCRYPTION_CHANGED 13
78 #define ORTP_EVENT_TMMBR_RECEIVED 14
79 
80 ORTP_PUBLIC OrtpEventData * ortp_event_get_data(OrtpEvent *ev);
81 ORTP_PUBLIC void ortp_event_destroy(OrtpEvent *ev);
82 ORTP_PUBLIC OrtpEvent *ortp_event_dup(OrtpEvent *ev);
83 
84 typedef struct OrtpEvQueue{
85  queue_t q;
86  ortp_mutex_t mutex;
87 } OrtpEvQueue;
88 
89 ORTP_PUBLIC OrtpEvQueue * ortp_ev_queue_new(void);
90 ORTP_PUBLIC void ortp_ev_queue_destroy(OrtpEvQueue *q);
91 ORTP_PUBLIC OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q);
92 ORTP_PUBLIC void ortp_ev_queue_flush(OrtpEvQueue * qp);
93 
94 #ifdef __cplusplus
95 }
96 #endif
97 
98 #endif
99 
Definition: port.h:277
Definition: str_utils.h:49
Definition: event.h:34
Definition: str_utils.h:78
Definition: event.h:84