getsockname(epoint->sockd, (struct sockaddr*)&epoint->peer.addr,
&epoint->peer.addrlen);
- epoint->sport = addr->sin_port;
+ epoint->sport = ntohs(addr->sin_port);
epoint->node = addr->sin_addr.s_addr;
FWP_DEBUG("Receive endpoint port=%d created.\n", ntohs(epoint->sport));
fwp_msgb_put(msgb, sizeof(struct fwp_msg_hello));
fwp_send(discovery_epointd, msgb->data, msgb->len);
-
+ FWP_DEBUG("Sent HELLO msg \n");
+
/* receive info from manager */
fwp_msgb_reset_data(msgb);
size = fwp_recv(fwp_mngt_repointd, msgb->data, msgb->buffer_size);
+ FWP_DEBUG("Received HELLO msg from mngr\n");
fwp_msgb_put(msgb, size);
/*skip header right now
/* create fwp manager participant record */
fwp_participant_mngr = fwp_participant_create(&mngr_info);
+ FWP_DEBUG("Received HELLO msg from nodeid= %d appid= %d\n",
+ mngr_info.id.node_id, mngr_info.id.app_id);
fwp_send_endpoint_unbind(discovery_epointd);
fwp_participant_mngr->vresd = service_vresd;
&fwp_participant_this->stream_id,
&flags,
fwp_mngt_repointd);
+
+ FWP_DEBUG("mngt_receive conf: nodeid=%d streamid=%d\n",
+ fwp_participant_this->id.node_id,
+ fwp_participant_this->stream_id);
return 0;
}
*
*/
-void fwp_msg_header_deflate(unsigned char *data, unsigned int type,
+void fwp_msg_header_deflate(unsigned char *data, fwp_msg_type_t type,
fwp_participant_id_t participant_id)
{
struct fwp_msg_header* msg_header;
msg_header->app_id = htonl(participant_id.app_id);
}
-void fwp_msg_header_inflate(unsigned char *data, unsigned int *type,
+void fwp_msg_header_inflate(unsigned char *data, fwp_msg_type_t *type,
fwp_participant_id_t *participant_id)
{
struct fwp_msg_header *msg_header;
#include "fwp_vres.h"
#include "fwp_participant.h"
-#define FWP_MSG_HELLO 0x00 /* contract negotiation request */
-#define FWP_MSG_NEGTREQ 0x02 /* contract negotiation request */
-#define FWP_MSG_NEGTRES 0x03 /* contract negotiation response */
+typedef enum {
+ FWP_MSG_HELLO = 1<<1,
+ FWP_MSG_NEGREQ = 1<<2,
+ FWP_MSG_NEGRES = 1<<3,
+ FWP_MSG_RESERVE = 1<<4,
+ FWP_MSG_COMMIT = 1<<5
+} fwp_msg_type_t;
struct fwp_msg_header{
uint16_t stream_id;
}__attribute__((packed));
-void fwp_msg_header_deflate(unsigned char *data, unsigned int type,
+void fwp_msg_header_deflate(unsigned char *data, fwp_msg_type_t type,
fwp_participant_id_t participant_id);
-void fwp_msg_header_inflate(unsigned char *data, unsigned int *type,
+void fwp_msg_header_inflate(unsigned char *data, fwp_msg_type_t *type,
fwp_participant_id_t *participant_id);
void fwp_msg_contract_deflate(unsigned char *data, struct fwp_contract *cont);
fwp_participant_info_t participant_info, my_info;
fwp_participant_t *participant;
+ FWP_DEBUG("Received HELLO msg from nodeid= %d appid= %d\n",
+ participant_id.node_id, participant_id.app_id);
+
/* Create a new participant */
fwp_msg_hello_inflate(msgb->data, &participant_info);
participant = fwp_participant_create(&participant_info);
fwp_msgb_put(msgb, sizeof(struct fwp_msg_header));
fwp_msg_hello_deflate(msgb->tail, &my_info);
fwp_msgb_put(msgb, sizeof(struct fwp_msg_hello));
- fwp_send(participant->epointd, msgb->data, msgb->len);
+ fwp_send(participant->epointd, msgb->data, msgb->len);
+
+ FWP_DEBUG("Sent HELLO msg \n");
}
/*void fwp_mngr_negt_request(msgb, participant_id)
void fwp_mngr_msg_handler(fwp_msgb_t *msgb)
{
- unsigned int msg_type;
+ fwp_msg_type_t msg_type;
fwp_participant_id_t participant_id;
fwp_msg_header_inflate(msgb->data, &msg_type, &participant_id);