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.smolik@wo.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) return -1;
43 CDR_put_octet(cdrCodec,INFO_REPLY);
46 flags=cdrCodec->data_endian;
47 CDR_put_octet(cdrCodec,flags);
50 CDR_put_ushort(cdrCodec,8);
53 CDR_put_ulong(cdrCodec,ipaddress);
56 CDR_put_ulong(cdrCodec,port);
60 /**********************************************************************************/
62 RTPSInfoREPLY(CDR_Codec *cdrCodec,MessageInterpret *mi)
68 /* restore flag possition in submessage */
72 CDR_get_octet(cdrCodec, (CORBA_octet *)&flags);
74 /* move reading possition to begin of submessage */
77 /* unicastReplyIPAddress */
78 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
80 /* unicastReplyPort */
81 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
83 debug(43,3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
84 mi->sourceHostId,mi->sourceAppId);
86 if (ipa!=IPADDRESS_INVALID) {
87 mi->unicastReplyIPAddress=ipa;
89 mi->unicastReplyPort=port;
92 /* multicastReplyIPAddress */
93 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&ipa);
95 /* multicastReplyPort */
96 CDR_get_ulong(cdrCodec, (CORBA_unsigned_long *)&port);
98 mi->multicastReplyIPAddress=ipa;
99 mi->multicastReplyPort=port;
101 mi->multicastReplyIPAddress=IPADDRESS_INVALID;
102 mi->multicastReplyPort =PORT_INVALID;