Merge remote-tracking branch 'origin/master' into 0.11
[platform/upstream/gstreamer.git] / libs / gst / net / gstnettimepacket.h
1 /* GStreamer
2  * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, USA.
18  */
19
20
21 #ifndef __GST_NET_TIME_PACKET_H__
22 #define __GST_NET_TIME_PACKET_H__
23
24 #include <gst/gst.h>
25
26 G_BEGIN_DECLS
27
28 #include <errno.h>
29 #include <string.h>
30 #include <sys/types.h>
31
32 #ifdef G_OS_WIN32
33 #include <winsock2.h>
34 #include <ws2tcpip.h>
35 #ifndef socklen_t
36 #define socklen_t int
37 #endif
38 #else
39 #include <netdb.h>
40 #include <sys/socket.h>
41 #include <netinet/in.h>
42 #include <arpa/inet.h>
43 #endif
44
45 /**
46  * GST_NET_TIME_PACKET_SIZE:
47  *
48  * The size of the packets sent between network clocks.
49  */
50 #define GST_NET_TIME_PACKET_SIZE 16
51
52 typedef struct _GstNetTimePacket GstNetTimePacket;
53
54 /**
55  * GstNetTimePacket:
56  * @local_time: the local time when this packet was sent
57  * @remote_time: the remote time observation
58  *
59  * Content of a #GstNetTimePacket.
60  */
61 struct _GstNetTimePacket {
62   GstClockTime local_time;
63   GstClockTime remote_time;
64 };
65
66 GstNetTimePacket*       gst_net_time_packet_new         (const guint8 *buffer);
67 guint8*                 gst_net_time_packet_serialize   (const GstNetTimePacket *packet);
68
69 GstNetTimePacket*       gst_net_time_packet_receive     (gint fd, struct sockaddr *addr,
70                                                          socklen_t *len);
71 gint                    gst_net_time_packet_send        (const GstNetTimePacket *packet,
72                                                          gint fd, struct sockaddr *addr,
73                                                          socklen_t len);
74
75 G_END_DECLS
76
77
78 #endif /* __GST_NET_TIME_PACKET_H__ */