2 * Copyright (C) 2005 Andy Wingo <wingo@pobox.com>
3 * Copyright (C) 2015 Sebastian Dröge <sebastian@centricular.com>
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
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 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #ifndef __GST_NTP_PACKET_H__
23 #define __GST_NTP_PACKET_H__
31 * GST_NTP_PACKET_SIZE:
33 * The size of the packets sent between NTP clocks.
35 #define GST_NTP_PACKET_SIZE 48
37 typedef struct _GstNtpPacket GstNtpPacket;
41 * @origin_time: the time the client packet was sent for the server
42 * @receive_time: the time the client packet was received
43 * @transmit_time: the time the packet was sent
44 * @poll_interval: maximum poll interval
46 * Content of a #GstNtpPacket.
48 struct _GstNtpPacket {
49 GstClockTime origin_time;
50 GstClockTime receive_time;
51 GstClockTime transmit_time;
53 GstClockTime poll_interval;
56 GType gst_ntp_packet_get_type(void) G_GNUC_INTERNAL;
59 GST_NTP_ERROR_WRONG_VERSION,
60 GST_NTP_ERROR_KOD_DENY,
61 GST_NTP_ERROR_KOD_RATE,
62 GST_NTP_ERROR_KOD_UNKNOWN
65 GQuark gst_ntp_error_quark (void) G_GNUC_INTERNAL;
66 #define GST_NTP_ERROR (gst_ntp_error_quark ())
68 GstNtpPacket* gst_ntp_packet_new (const guint8 *buffer,
69 GError ** error) G_GNUC_INTERNAL;
70 GstNtpPacket* gst_ntp_packet_copy (const GstNtpPacket *packet) G_GNUC_INTERNAL;
71 void gst_ntp_packet_free (GstNtpPacket *packet) G_GNUC_INTERNAL;
73 guint8* gst_ntp_packet_serialize (const GstNtpPacket *packet) G_GNUC_INTERNAL;
75 GstNtpPacket* gst_ntp_packet_receive (GSocket * socket,
76 GSocketAddress ** src_address,
77 GError ** error) G_GNUC_INTERNAL;
79 gboolean gst_ntp_packet_send (const GstNtpPacket * packet,
81 GSocketAddress * dest_address,
82 GError ** error) G_GNUC_INTERNAL;
86 #endif /* __GST_NET_TIME_PACKET_H__ */