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  } info;
51 };
52 
53 typedef struct _OrtpEventData OrtpEventData;
54 
55 
56 
57 #ifdef __cplusplus
58 extern "C"{
59 #endif
60 
61 ORTP_PUBLIC OrtpEvent * ortp_event_new(OrtpEventType tp);
62 ORTP_PUBLIC OrtpEventType ortp_event_get_type(const OrtpEvent *ev);
63 /* type is one of the following*/
64 #define ORTP_EVENT_STUN_PACKET_RECEIVED 1
65 #define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2
66 #define ORTP_EVENT_TELEPHONE_EVENT 3
67 #define ORTP_EVENT_RTCP_PACKET_RECEIVED 4
68 #define ORTP_EVENT_RTCP_PACKET_EMITTED 5
69 #define ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED 6
70 #define ORTP_EVENT_ZRTP_SAS_READY 7
71 #define ORTP_EVENT_ICE_CHECK_LIST_PROCESSING_FINISHED 8
72 #define ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED 9
73 #define ORTP_EVENT_ICE_GATHERING_FINISHED 10
74 #define ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED 11
75 #define ORTP_EVENT_ICE_RESTART_NEEDED 12
76 #define ORTP_EVENT_DTLS_ENCRYPTION_CHANGED 13
77 
78 ORTP_PUBLIC OrtpEventData * ortp_event_get_data(OrtpEvent *ev);
79 ORTP_PUBLIC void ortp_event_destroy(OrtpEvent *ev);
80 ORTP_PUBLIC OrtpEvent *ortp_event_dup(OrtpEvent *ev);
81 
82 typedef struct OrtpEvQueue{
83  queue_t q;
84  ortp_mutex_t mutex;
85 } OrtpEvQueue;
86 
87 ORTP_PUBLIC OrtpEvQueue * ortp_ev_queue_new(void);
88 ORTP_PUBLIC void ortp_ev_queue_destroy(OrtpEvQueue *q);
89 ORTP_PUBLIC OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q);
90 ORTP_PUBLIC void ortp_ev_queue_flush(OrtpEvQueue * qp);
91 
92 #ifdef __cplusplus
93 }
94 #endif
95 
96 #endif
97 
Definition: port.h:277
Definition: str_utils.h:49
Definition: event.h:34
Definition: str_utils.h:78
Definition: event.h:82