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 
34 typedef struct RtpEndpoint{
35 #ifdef ORTP_INET6
36  struct sockaddr_storage addr;
37 #else
38  struct sockaddr addr;
39 #endif
40  socklen_t addrlen;
42 
43 
45  mblk_t *packet; /* most events are associated to a received packet */
46  RtpEndpoint *ep;
47  ortpTimeSpec ts;
48  union {
49  int telephone_event;
50  int payload_type;
51  bool_t zrtp_stream_encrypted;
52  struct _ZrtpSas{
53  char sas[5]; // 4 characters
54  bool_t verified;
55  } zrtp_sas;
56  OrtpSocketType socket_type;
57  bool_t ice_processing_successful;
58  } info;
59 };
60 
61 typedef struct _OrtpEventData OrtpEventData;
62 
63 
64 
65 #ifdef __cplusplus
66 extern "C"{
67 #endif
68 
69 ORTP_PUBLIC RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen);
70 ORTP_PUBLIC RtpEndpoint *rtp_endpoint_dup(const RtpEndpoint *ep);
71 
72 ORTP_PUBLIC OrtpEvent * ortp_event_new(OrtpEventType tp);
73 ORTP_PUBLIC OrtpEventType ortp_event_get_type(const OrtpEvent *ev);
74 /* type is one of the following*/
75 #define ORTP_EVENT_STUN_PACKET_RECEIVED 1
76 #define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2
77 #define ORTP_EVENT_TELEPHONE_EVENT 3
78 #define ORTP_EVENT_RTCP_PACKET_RECEIVED 4
79 #define ORTP_EVENT_RTCP_PACKET_EMITTED 5
80 #define ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED 6
81 #define ORTP_EVENT_ZRTP_SAS_READY 7
82 #define ORTP_EVENT_ICE_CHECK_LIST_PROCESSING_FINISHED 8
83 #define ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED 9
84 #define ORTP_EVENT_ICE_GATHERING_FINISHED 10
85 #define ORTP_EVENT_ICE_LOSING_PAIRS_COMPLETED 11
86 #define ORTP_EVENT_ICE_RESTART_NEEDED 12
87 
88 ORTP_PUBLIC OrtpEventData * ortp_event_get_data(OrtpEvent *ev);
89 ORTP_PUBLIC void ortp_event_destroy(OrtpEvent *ev);
90 ORTP_PUBLIC OrtpEvent *ortp_event_dup(OrtpEvent *ev);
91 
92 typedef struct OrtpEvQueue{
93  queue_t q;
94  ortp_mutex_t mutex;
95 } OrtpEvQueue;
96 
97 ORTP_PUBLIC OrtpEvQueue * ortp_ev_queue_new(void);
98 ORTP_PUBLIC void ortp_ev_queue_destroy(OrtpEvQueue *q);
99 ORTP_PUBLIC OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q);
100 ORTP_PUBLIC void ortp_ev_queue_flush(OrtpEvQueue * qp);
101 
102 #ifdef __cplusplus
103 }
104 #endif
105 
106 #endif
107 
Definition: port.h:258
Definition: str_utils.h:49
Definition: event.h:44
Definition: str_utils.h:75
Definition: event.h:92
Definition: event.h:34