2 * $Id: RTPSInfoREPLY.c,v 0.0.0.1 2003/09/1
4 * DEBUG: section 43 message INFO REPLY
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 RTPSInfoREPLYCreate(CDR_Codec *cdrCodec,IPAddress ipaddress,Port port)
30 if (cdrCodec->buf_len<cdrCodec->wptr+12) return -1;
33 CDR_put_octet(cdrCodec,INFO_REPLY);
36 flags=cdrCodec->data_endian;
37 CDR_put_octet(cdrCodec,flags);
40 CDR_put_ushort(cdrCodec,8);
43 CDR_put_ulong(cdrCodec,ipaddress);
46 CDR_put_ulong(cdrCodec,port);
50 /**********************************************************************************/
52 RTPSInfoREPLY(CDR_Codec *cdrCodec,MessageInterpret *mi)
58 /* restore flag possition in submessage */
62 CDR_get_octet(cdrCodec,&flags);
64 /* move reading possition to begin of submessage */
67 /* unicastReplyIPAddress */
68 CDR_get_ulong(cdrCodec,&ipa);
70 /* unicastReplyPort */
71 CDR_get_ulong(cdrCodec,&port);
73 debug(43,3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
74 mi->sourceHostId,mi->sourceAppId);
76 if (ipa!=IPADDRESS_INVALID) {
77 mi->unicastReplyIPAddress=ipa;
79 mi->unicastReplyPort=port;
82 /* multicastReplyIPAddress */
83 CDR_get_ulong(cdrCodec,&ipa);
85 /* multicastReplyPort */
86 CDR_get_ulong(cdrCodec,&port);
88 mi->multicastReplyIPAddress=ipa;
89 mi->multicastReplyPort=port;
91 mi->multicastReplyIPAddress=IPADDRESS_INVALID;
92 mi->multicastReplyPort =PORT_INVALID;