2 * $Id: RTPSInfoTS.c,v 0.0.0.1 2003/09/10
4 * DEBUG: section 45 message INFO TS
5 * AUTHOR: Petr Smolik petr.smolik@wo.cz
7 * ORTE - OCERA Real-Time Ethernet http://www.ocera.org/
8 * --------------------------------------------------------------------
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
24 /**********************************************************************************/
26 RTPSInfoTSCreate(u_int8_t *rtps_msg,u_int32_t max_msg_len,NtpTime time) {
27 if (max_msg_len<12) return -1;
28 rtps_msg[0]=(u_int8_t)INFO_TS;
29 rtps_msg[1]=ORTE_MY_MBO; //I-bit = 0
30 *((ParameterLength*)(rtps_msg+2))=8;
31 *((NtpTime*)(rtps_msg+4))=time;
35 /**********************************************************************************/
37 RTPSInfoTS(u_int8_t *rtps_msg,MessageInterpret *mi) {
38 int8_t e_bit=rtps_msg[1] & 0x01;
39 char buff[MAX_STRING_NTPTIME_LENGTH];
41 if ((rtps_msg[1] & 0x02)==0) { /* I = bit */
42 mi->haveTimestamp=ORTE_TRUE;
43 mi->timestamp=*((NtpTime*)(rtps_msg+4));
44 conv_sn((SequenceNumber*)&mi->timestamp,e_bit);
46 mi->haveTimestamp=ORTE_FALSE;
47 NTPTIME_ZERO(mi->timestamp);
49 if (mi->haveTimestamp)
50 debug(45,3) ("recv: RTPSInfoTS, timestamp %s\n",
51 NtpTimeToStringUs(mi->timestamp, buff));
53 debug(45,3) ("recv: RTPSInfoTS\n");