2 * $Id: RTPSInfoREPLY.c,v 0.0.0.1 2003/09/1
4 * DEBUG: section 43 message INFO REPLY
6 * -------------------------------------------------------------------
8 * Open Real-Time Ethernet
10 * Copyright (C) 2001-2006
11 * Department of Control Engineering FEE CTU Prague, Czech Republic
12 * http://dce.felk.cvut.cz
13 * http://www.ocera.org
15 * Author: Petr Smolik petr@smoliku.cz
17 * Project Responsible: Zdenek Hanzalek
18 * --------------------------------------------------------------------
20 * This program is free software; you can redistribute it and/or modify
21 * it under the terms of the GNU General Public License as published by
22 * the Free Software Foundation; either version 2 of the License, or
23 * (at your option) any later version.
25 * This program is distributed in the hope that it will be useful,
26 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
28 * GNU General Public License for more details.
34 /**********************************************************************************/
36 RTPSInfoREPLYCreate(CDR_Codec *cdrCodec, IPAddress ipaddress, Port port)
40 if (cdrCodec->buf_len < cdrCodec->wptr+12)
44 CDR_put_octet(cdrCodec, INFO_REPLY);
47 flags = cdrCodec->data_endian;
48 CDR_put_octet(cdrCodec, flags);
51 CDR_put_ushort(cdrCodec, 8);
54 CDR_put_ulong(cdrCodec, ipaddress);
57 CDR_put_ulong(cdrCodec, port);
61 /**********************************************************************************/
63 RTPSInfoREPLY(CDR_Codec *cdrCodec, MessageInterpret *mi)
69 /* restore flag possition in submessage */
73 CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
75 /* move reading possition to begin of submessage */
78 /* unicastReplyIPAddress */
79 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
81 /* unicastReplyPort */
82 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
84 debug(43, 3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
85 mi->sourceHostId, mi->sourceAppId);
87 if (ipa != IPADDRESS_INVALID) {
88 mi->unicastReplyIPAddress = ipa;
90 mi->unicastReplyPort = port;
93 /* multicastReplyIPAddress */
94 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
96 /* multicastReplyPort */
97 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
99 mi->multicastReplyIPAddress = ipa;
100 mi->multicastReplyPort = port;
102 mi->multicastReplyIPAddress = IPADDRESS_INVALID;
103 mi->multicastReplyPort = PORT_INVALID;