static gboolean kms_sdp_message_context_set_default_session_attributes (GstSDPMessage * msg, SdpIPv ipv, const gchar * addr, GError ** error) { const gchar *addrtype, *err_attr; gchar *ntp; addrtype = get_attr_addr_type (ipv); if (addrtype == NULL) { err_attr = "ip version"; goto error; } if (gst_sdp_message_set_version (msg, "0") != GST_SDP_OK) { err_attr = "version"; goto error; } /* The method of generating <sess-id> and <sess-version> is up to the */ /* creating tool, but it has been suggested that a Network Time Protocol */ /* (NTP) format timestamp be used to ensure uniqueness [rfc4566] 5.2 */ ntp = g_strdup_printf ("%" G_GUINT64_FORMAT, get_ntp_time ()); if (gst_sdp_message_set_origin (msg, "-", ntp, ntp, ORIGIN_ATTR_NETTYPE, addrtype, addr) != GST_SDP_OK) { err_attr = "origin"; g_free (ntp); goto error; } g_free (ntp); if (gst_sdp_message_set_session_name (msg, "Kurento Media Server") != GST_SDP_OK) { err_attr = "session"; goto error; } if (gst_sdp_message_set_connection (msg, ORIGIN_ATTR_NETTYPE, addrtype, addr, 0, 0) != GST_SDP_OK) { err_attr = "connection"; goto error; } return TRUE; error: g_set_error (error, KMS_SDP_AGENT_ERROR, SDP_AGENT_INVALID_PARAMETER, "Can not set attr: %s", err_attr); return FALSE; }
void cmd_ntp(int argc, char **argv) { get_ntp_time(); }