return 0;
}
+/* Launch discovery/connect process to
+ * introduce itself to fwp manager and get description of manager*/
void fwp_mngt_connect()
{
fwp_participant_info_t my_info, mngr_info;
fwp_msgb_t *msgb;
fwp_msg_type_t msg_type;
-#if 0
- FWP_DEBUG("Service vres created\n");
- fwp_mngt_service_vres_create(&service_vresd);
-
- /* Create discovery endpint */
- FWP_DEBUG("Discovery send endpoint created\n");
- fwp_send_endpoint_create(inet_addr("127.0.0.1"),
- FWP_MNGT_DISCOVERY_STREAM_ID,
- 0, &discovery_epointd);
- fwp_send_endpoint_bind(discovery_epointd, service_vresd);
-#endif
- /* Launch discovery process */
- /* introduce yourself to resource manager */
+ /* prepare hello message */
msgb = fwp_msgb_alloc(sizeof(struct fwp_msg_header) +
sizeof(struct fwp_msg_hello));
fwp_msgb_reserve(msgb, sizeof(struct fwp_msg_header));
-#if 0
- fwp_msg_header_deflate(msgb->tail, FWP_MSG_HELLO,
- fwp_participant_this->id);
- fwp_msgb_put(msgb, sizeof(struct fwp_msg_header));
-#endif
+
my_info.id = fwp_participant_this->id;
my_info.stream_id = fwp_participant_this->stream_id;
fwp_msg_hello_deflate(msgb->tail, &my_info);
fwp_msgb_put(msgb, sizeof(struct fwp_msg_hello));
- /*fwp_send(discovery_epointd, msgb->data, msgb->len);
- FWP_DEBUG("Sent HELLO msg \n");*/
+ /* Send hello to manager */
fwp_mngt_send(FWP_MSG_HELLO, msgb,
fwp_participant_this, fwp_participant_mngr);
- /* receive info from manager */
-
-#if 0
- 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
- *fwp_msg_header_inflate(msgb->data, &msg_header);
- */
- fwp_msgb_pull(msgb, sizeof(struct fwp_msg_header));
-#endif
+ /* receive hello from manager */
fwp_mngt_recv(&msg_type, &participant_id, msgb);
- fwp_msg_hello_inflate(msgb->data, &mngr_info);
-
- /* create fwp manager participant record */
- //fwp_participant_mngr = fwp_participant_create(&mngr_info);
FWP_DEBUG("Received HELLO msg from nodeid= %d appid= %d\n",
+ participant_id.node_id, participant_id.app_id);
+
+
+ /* Process hello msg from manager */
+ fwp_msg_hello_inflate(msgb->data, &mngr_info);
+ fwp_participant_mngr->id = mngr_info.id;
+ fwp_participant_mngr->stream_id = mngr_info.stream_id;
+ FWP_DEBUG("Received HELLO msg contains nodeid= %d appid= %d\n",
mngr_info.id.node_id, mngr_info.id.app_id);
+ /* unbind and delete discovery mngr send endoint */
fwp_send_endpoint_unbind(fwp_participant_mngr->epointd);
/*fwp_endpoint_free(fwp_participant_mngr->epointd)*/
- //fwp_participant_mngr->vresd = service_vresd;
- fwp_participant_mngr->id = mngr_info.id;
- fwp_participant_mngr->stream_id = mngr_info.stream_id;
- FWP_DEBUG("Management send endpoint created\n");
+ /* Create mngt send endpoint to manager */
fwp_send_endpoint_create(fwp_participant_mngr->id.node_id,
fwp_participant_mngr->stream_id, 0,
&fwp_participant_mngr->epointd);
+ FWP_DEBUG("Management send endpoint created\n");
fwp_send_endpoint_bind(fwp_participant_mngr->epointd,
fwp_participant_mngr->vresd);
}