| 1 |
/* GStreamer |
| 2 |
* Copyright (C) 2005 Andy Wingo <[email protected]> |
| 3 |
* Copyright (C) 2015 Sebastian Dröge <[email protected]> |
| 4 |
* |
| 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. |
| 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 |
* Library General Public License for more details. |
| 14 |
* |
| 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. |
| 19 |
*/ |
| 20 |
|
| 21 |
|
| 22 |
#ifndef __GST_NTP_PACKET_H__ |
| 23 |
#define __GST_NTP_PACKET_H__ |
| 24 |
|
| 25 |
#include <gst/gst.h> |
| 26 |
#include <gio/gio.h> |
| 27 |
|
| 28 |
G_BEGIN_DECLS |
| 29 |
|
| 30 |
/** |
| 31 |
* GST_NTP_PACKET_SIZE: |
| 32 |
* |
| 33 |
* The size of the packets sent between NTP clocks. |
| 34 |
*/ |
| 35 |
#define GST_NTP_PACKET_SIZE 48 |
| 36 |
|
| 37 |
typedef struct _GstNtpPacket GstNtpPacket; |
| 38 |
|
| 39 |
/** |
| 40 |
* 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 |
| 45 |
* |
| 46 |
* Content of a #GstNtpPacket. |
| 47 |
*/ |
| 48 |
struct _GstNtpPacket { |
| 49 |
GstClockTime origin_time; |
| 50 |
GstClockTime receive_time; |
| 51 |
GstClockTime transmit_time; |
| 52 |
|
| 53 |
GstClockTime poll_interval; |
| 54 |
}; |
| 55 |
|
| 56 |
GType gst_ntp_packet_get_type(void) G_GNUC_INTERNAL; |
| 57 |
|
| 58 |
enum { |
| 59 |
GST_NTP_ERROR_WRONG_VERSION, |
| 60 |
GST_NTP_ERROR_KOD_DENY, |
| 61 |
GST_NTP_ERROR_KOD_RATE, |
| 62 |
GST_NTP_ERROR_KOD_UNKNOWN |
| 63 |
}; |
| 64 |
|
| 65 |
GQuark gst_ntp_error_quark (void) G_GNUC_INTERNAL; |
| 66 |
#define GST_NTP_ERROR (gst_ntp_error_quark ()) |
| 67 |
|
| 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; |
| 72 |
|
| 73 |
guint8* gst_ntp_packet_serialize (const GstNtpPacket *packet) G_GNUC_INTERNAL; |
| 74 |
|
| 75 |
GstNtpPacket* gst_ntp_packet_receive (GSocket * socket, |
| 76 |
GSocketAddress ** src_address, |
| 77 |
GError ** error) G_GNUC_INTERNAL; |
| 78 |
|
| 79 |
gboolean gst_ntp_packet_send (const GstNtpPacket * packet, |
| 80 |
GSocket * socket, |
| 81 |
GSocketAddress * dest_address, |
| 82 |
GError ** error) G_GNUC_INTERNAL; |
| 83 |
|
| 84 |
G_END_DECLS |
| 85 |
|
| 86 |
#endif /* __GST_NET_TIME_PACKET_H__ */ |