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