oRTP 0.16.3
|
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 } info; 00046 }; 00047 00048 typedef struct _OrtpEventData OrtpEventData; 00049 00050 00051 00052 #ifdef __cplusplus 00053 extern "C"{ 00054 #endif 00055 00056 RtpEndpoint *rtp_endpoint_new(struct sockaddr *addr, socklen_t addrlen); 00057 RtpEndpoint *rtp_endpoint_dup(const RtpEndpoint *ep); 00058 00059 OrtpEvent * ortp_event_new(OrtpEventType tp); 00060 OrtpEventType ortp_event_get_type(const OrtpEvent *ev); 00061 /* type is one of the following*/ 00062 #define ORTP_EVENT_STUN_PACKET_RECEIVED 1 00063 #define ORTP_EVENT_PAYLOAD_TYPE_CHANGED 2 00064 #define ORTP_EVENT_TELEPHONE_EVENT 3 00065 #define ORTP_EVENT_RTCP_PACKET_RECEIVED 4 00066 OrtpEventData * ortp_event_get_data(OrtpEvent *ev); 00067 void ortp_event_destroy(OrtpEvent *ev); 00068 OrtpEvent *ortp_event_dup(OrtpEvent *ev); 00069 00070 typedef struct OrtpEvQueue{ 00071 queue_t q; 00072 ortp_mutex_t mutex; 00073 } OrtpEvQueue; 00074 00075 OrtpEvQueue * ortp_ev_queue_new(void); 00076 void ortp_ev_queue_destroy(OrtpEvQueue *q); 00077 OrtpEvent * ortp_ev_queue_get(OrtpEvQueue *q); 00078 void ortp_ev_queue_flush(OrtpEvQueue * qp); 00079 00080 #ifdef __cplusplus 00081 } 00082 #endif 00083 00084 #endif 00085