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(u_int8_t *rtps_msg,u_int32_t max_msg_len,
27 IPAddress ipaddress,Port port) {
29 if (max_msg_len<12) return -1;
30 rtps_msg[0]=(u_int8_t)INFO_REPLY;
31 rtps_msg[1]=ORTE_MY_MBO;
32 *((ParameterLength*)(rtps_msg+2))=8;
33 *((ObjectId*)(rtps_msg+4))=ipaddress;
34 *((ObjectId*)(rtps_msg+8))=port;
38 /**********************************************************************************/
40 RTPSInfoREPLY(u_int8_t *rtps_msg,MessageInterpret *mi) {
46 e_bit=rtps_msg[1] & 0x01;
47 ipa=*((IPAddress*)(rtps_msg+4)); /* unicastReplyIPAddress */
49 port=*((Port*)(rtps_msg+8)); /* unicastReplyPort */
52 debug(43,3) ("recv: RTPS InfoREPLY from 0x%x-0x%x\n",
53 mi->sourceHostId,mi->sourceAppId);
55 if (ipa!=IPADDRESS_INVALID) {
56 mi->unicastReplyIPAddress=ipa;
58 mi->unicastReplyPort=port;
59 if (rtps_msg[1] & 0x02) {
60 ipa=*((u_int32_t*)(rtps_msg+12)); /* multicastReplyIPAddress */
62 port=*((u_int32_t*)(rtps_msg+16)); /* multicastReplyPort */
63 conv_u32(&port,e_bit);
64 mi->multicastReplyIPAddress=ipa;
65 mi->multicastReplyPort=port;
67 mi->multicastReplyIPAddress=IPADDRESS_INVALID;
68 mi->multicastReplyPort =PORT_INVALID;