oRTP 0.18.0
|
00001 /* 00002 The oRTP library is an RTP (Realtime Transport Protocol - rfc3550) stack. 00003 Copyright (C) 2001 Simon MORLAT simon.morlat@linphone.org 00004 00005 This library is free software; you can redistribute it and/or 00006 modify it under the terms of the GNU Lesser General Public 00007 License as published by the Free Software Foundation; either 00008 version 2.1 of the License, or (at your option) any later version. 00009 00010 This library is distributed in the hope that it will be useful, 00011 but WITHOUT ANY WARRANTY; without even the implied warranty of 00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00013 Lesser General Public License for more details. 00014 00015 You should have received a copy of the GNU Lesser General Public 00016 License along with this library; if not, write to the Free Software 00017 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00018 */ 00019 00020 #ifndef ortp_events_h 00021 #define ortp_events_h 00022 00023 #include <ortp/str_utils.h> 00024 00025 typedef mblk_t OrtpEvent; 00026 00027 typedef unsigned long OrtpEventType; 00028 00029 typedef struct RtpEndpoint{ 00030 #ifdef ORTP_INET6 00031 struct sockaddr_storage addr; 00032 #else 00033 struct sockaddr addr; 00034 #endif 00035 socklen_t addrlen; 00036 }RtpEndpoint; 00037 00038 00039 struct _OrtpEventData{ 00040 mblk_t *packet; /* most events are associated to a received packet */ 00041 RtpEndpoint *ep; 00042 union { 00043 int telephone_event; 00044 int payload_type; 00045 bool_t zrtp_stream_encrypted; 00046 struct _ZrtpSas{ 00047 char sas[5]; // 4 characters 00048 bool_t verified; 00049 } zrtp_sas; 00050 } info; 00051 }; 00052 00053 typedef struct _OrtpEventData OrtpEventData; 00054 00055 00056 00057 #ifdef __cplusplus 00058 extern "C"{ 00059 #endif 00060 00061 RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen); 00062 RtpEndpoint *rtp_endpoint_dup(const RtpEndpoint *ep); 00063 00064 OrtpEvent * ortp_event_new(OrtpEventType tp); 00065 OrtpEventType ortp_event_get_type(const OrtpEvent *ev); 00066 /* type is one of the following*/ 00067 #define ORTP_EVENT_STUN_PACKET_RECEIVED 1 00068 #define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2 00069 #define ORTP_EVENT_TELEPHONE_EVENT 3 00070 #define ORTP_EVENT_RTCP_PACKET_RECEIVED 4 00071 #define ORTP_EVENT_RTCP_PACKET_EMITTED 5 00072 #define ORTP_EVENT_ZRTP_ENCRYPTION_CHANGED 6 00073 #define ORTP_EVENT_ZRTP_SAS_READY 7 00074 00075 OrtpEventData * ortp_event_get_data(OrtpEvent *ev); 00076 void ortp_event_destroy(OrtpEvent *ev); 00077 OrtpEvent *ortp_event_dup(OrtpEvent *ev); 00078 00079 typedef struct OrtpEvQueue{ 00080 queue_t q; 00081 ortp_mutex_t mutex; 00082 } OrtpEvQueue; 00083 00084 OrtpEvQueue * ortp_ev_queue_new(void); 00085 void ortp_ev_queue_destroy(OrtpEvQueue *q); 00086 OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q); 00087 void ortp_ev_queue_flush(OrtpEvQueue * qp); 00088 00089 #ifdef __cplusplus 00090 } 00091 #endif 00092 00093 #endif 00094