dart/gni/ds_base_gni.c
static int dsrpc_announce_cp(struct rpc_server *rpc_s, struct rpc_cmd *cmd)
{
	struct dart_server *ds = ds_ref_from_rpc(rpc_s);
	struct msg_buf *msg;
	struct node_id *peer;
        struct app_info *app;
	int err = -ENOMEM;
	int i, j;
	int info_size;

	struct gni_smsg_attr_info *tmp_attr_info;
	struct gni_smsg_attr_info *cur_attr_info = (struct gni_smsg_attr_info *)(cmd->pad);
	//cur_attr_info->remote_smsg_attr = (gni_smsg_attr_t *)(cur_attr_info+1);	


	app = app_find(ds, cur_attr_info->appid);
	tmp_attr_info = rpc_s->attr_info_start;


	while(tmp_attr_info){
		if(tmp_attr_info->appid == cur_attr_info->appid){
			break;
		}
		else
			tmp_attr_info = tmp_attr_info->next;	
	}

	if(!tmp_attr_info)
		printf("'%s()': attr_info NULL.\n", __func__);

	tmp_attr_info->remote_smsg_attr[cmd->id] = cur_attr_info->local_smsg_attr;
	tmp_attr_info->tmp_num++;

	if(tmp_attr_info->tmp_num == ds->num_sp-1)
		app->f_reg = 1;

	if(app->f_reg == 1){
		//send all attr info to master client of such app.
	  tmp_attr_info->remote_smsg_attr[0] = tmp_attr_info->local_smsg_attr;
	  
		peer = app->app_peer_tab;
		msg = msg_buf_alloc(rpc_s, peer, 1);
		if (!msg) 
			goto err_out;


		msg->msg_rpc->cmd = cn_register;
		msg->msg_rpc->id = ds->rpc_s->ptlmap.id;

		msg->size = info_size = ds->num_sp * sizeof(gni_smsg_attr_t);

		msg->msg_data = (gni_smsg_attr_t *)malloc(info_size);
		memcpy(msg->msg_data, tmp_attr_info->remote_smsg_attr, info_size);
		//msg->msg_data = tmp_attr_info->remote_smsg_attr;//ToDo
                msg->cb = default_completion_with_data_callback;

		err = rpc_send(rpc_s, peer, msg);
		if (err != 0){
			free(msg);
			goto err_out;
		}		

	}

    return 0;

 err_out:
	printf("(%s): failed. (%d)\n", __func__, err);
	return err;
}
// Master server gets slave servers announcement, gather their attr for app. 

Master server gets slave servers announcement, gather their attr for app.
Master server gets slave servers announcement gather their attr for app .
static int dsrpc_announce_cp(struct rpc_server *rpc_s, struct rpc_cmd *cmd)
{
	struct dart_server *ds = ds_ref_from_rpc(rpc_s);
	struct msg_buf *msg;
	struct node_id *peer;
        struct app_info *app;
	int err = -ENOMEM;
	int i, j;
	int info_size;
	struct gni_smsg_attr_info *tmp_attr_info;
	struct gni_smsg_attr_info *cur_attr_info = (struct gni_smsg_attr_info *)(cmd->pad);
	app = app_find(ds, cur_attr_info->appid);
	tmp_attr_info = rpc_s->attr_info_start;
	while(tmp_attr_info){
		if(tmp_attr_info->appid == cur_attr_info->appid){
			break;
		}
		else
			tmp_attr_info = tmp_attr_info->next;	
	}
	if(!tmp_attr_info)
		printf("'%s()': attr_info NULL.\n", __func__);
	tmp_attr_info->remote_smsg_attr[cmd->id] = cur_attr_info->local_smsg_attr;
	tmp_attr_info->tmp_num++;
	if(tmp_attr_info->tmp_num == ds->num_sp-1)
		app->f_reg = 1;
	if(app->f_reg == 1){
	  tmp_attr_info->remote_smsg_attr[0] = tmp_attr_info->local_smsg_attr;
		peer = app->app_peer_tab;
		msg = msg_buf_alloc(rpc_s, peer, 1);
		if (!msg) 
			goto err_out;
		msg->msg_rpc->cmd = cn_register;
		msg->msg_rpc->id = ds->rpc_s->ptlmap.id;
		msg->size = info_size = ds->num_sp * sizeof(gni_smsg_attr_t);
		msg->msg_data = (gni_smsg_attr_t *)malloc(info_size);
		memcpy(msg->msg_data, tmp_attr_info->remote_smsg_attr, info_size);
                msg->cb = default_completion_with_data_callback;
		err = rpc_send(rpc_s, peer, msg);
		if (err != 0){
			free(msg);
			goto err_out;
		}		
	}
    return 0;
 err_out:
	printf("(%s): failed. (%d)\n", __func__, err);
	return err;
}
static int dsrpc_announce_cp ( struct rpc_server * rpc_s , struct rpc_cmd * cmd ) { struct dart_server * ds = ds_ref_from_rpc ( rpc_s ) ; struct msg_buf * msg ; struct node_id * peer ; struct app_info * app ; int err = - ENOMEM ; int i , j ; int info_size ; struct gni_smsg_attr_info * tmp_attr_info ; struct gni_smsg_attr_info * cur_attr_info = ( struct gni_smsg_attr_info * ) ( cmd -> pad ) ; app = app_find ( ds , cur_attr_info -> appid ) ; tmp_attr_info = rpc_s -> attr_info_start ; while ( tmp_attr_info ) { if ( tmp_attr_info -> appid == cur_attr_info -> appid ) { break ; } else tmp_attr_info = tmp_attr_info -> next ; } if ( ! tmp_attr_info ) printf ( " \n " , __func__ ) ; tmp_attr_info -> remote_smsg_attr [ cmd -> id ] = cur_attr_info -> local_smsg_attr ; tmp_attr_info -> tmp_num ++ ; if ( tmp_attr_info -> tmp_num == ds -> num_sp - 1 ) app -> f_reg = 1 ; if ( app -> f_reg == 1 ) { tmp_attr_info -> remote_smsg_attr [ 0 ] = tmp_attr_info -> local_smsg_attr ; peer = app -> app_peer_tab ; msg = msg_buf_alloc ( rpc_s , peer , 1 ) ; if ( ! msg ) goto err_out ; msg -> msg_rpc -> cmd = cn_register ; msg -> msg_rpc -> id = ds -> rpc_s -> ptlmap . id ; msg -> size = info_size = ds -> num_sp * sizeof ( gni_smsg_attr_t ) ; msg -> msg_data = ( gni_smsg_attr_t * ) malloc ( info_size ) ; memcpy ( msg -> msg_data , tmp_attr_info -> remote_smsg_attr , info_size ) ; msg -> cb = default_completion_with_data_callback ; err = rpc_send ( rpc_s , peer , msg ) ; if ( err != 0 ) { free ( msg ) ; goto err_out ; } } return 0 ; err_out : printf ( " \n " , __func__ , err ) ; return err ; }
Master server gets slave servers announcement, gather their attr for app.
Master server gets slave servers announcement gather their attr for app .
//cur_attr_info->remote_smsg_attr = (gni_smsg_attr_t *)(cur_attr_info+1);	
 //send all attr info to master client of such app.
 //msg->msg_data = tmp_attr_info->remote_smsg_attr;//ToDo
