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