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