]> rtime.felk.cvut.cz Git - orte.git/blob - orte/liborte/RTPSInfoSRC.c
Update of ORTE. Configured to compile for Linux out of box.
[orte.git] / orte / liborte / RTPSInfoSRC.c
1 /*
2  *  $Id: RTPSInfoSRC.c,v 0.0.0.1      2003/09/10
3  *
4  *  DEBUG:  section 44                  message INFO SRC
5  *  AUTHOR: Petr Smolik                 petr.smolik@wo.cz
6  *
7  *  ORTE - OCERA Real-Time Ethernet     http://www.ocera.org/
8  *  --------------------------------------------------------------------
9  *
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.
14  *  
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.
19  *  
20  */ 
21
22 #include "orte.h"
23
24 /**********************************************************************************/
25 void RTPSInfoSRC(u_int8_t *rtps_msg,MessageInterpret *mi) {
26   IPAddress          ipa;
27   ProtocolVersion    protocol;
28   VendorId           vid;
29   HostId             hid;
30   AppId              aid;
31   int8_t             e_bit;
32   char               sIPAddress[MAX_STRING_IPADDRESS_LENGTH];
33
34   //Parsing
35   e_bit=rtps_msg[1] & 0x01;
36   ipa=*((IPAddress*)(rtps_msg+4));              /* appIPAddress */
37   conv_u32(&ipa,e_bit);
38   protocol=*((ProtocolVersion*)(rtps_msg+8));   /* ProtocolVersion */
39   vid=*((VendorId*)(rtps_msg+10));              /* Vendor Id */
40   hid=*((HostId*)(rtps_msg+12));                /* HostId */
41   conv_u32(&hid,0);
42   aid=*((AppId*)(rtps_msg+16));                 /* AppId */
43   conv_u32(&aid,0);
44
45   debug(44,3) ("  RTPSInfoSRC: \n");
46   debug(44,4) ("    appIPAddress:%s\n",IPAddressToString(ipa,sIPAddress));
47   debug(44,4) ("    pv:%lu,%lu vid:%lu,%lu hid:0x%x aid:0x%x\n",
48                              protocol.major,protocol.minor,vid.major,vid.minor,hid,aid);
49
50   mi->sourceHostId=hid;
51   mi->sourceAppId=aid;
52   mi->sourceVersion=protocol;
53   mi->sourceVendorId=vid;
54   mi->unicastReplyIPAddress=ipa;
55   mi->unicastReplyPort=PORT_INVALID;
56   mi->multicastReplyIPAddress=IPADDRESS_INVALID;
57   mi->multicastReplyPort=PORT_INVALID;
58   mi->haveTimestamp=ORTE_FALSE;
59 }