src/client_list.c
int sendAuthStatus(reg_list_item_t *new_node)
{
	int byte = 0, nbytes = -1;	
	size_t size=0;
	void *auth_bytes;
	wrp_msg_t auth_msg_var;
	int status = -1;
	
	auth_msg_var.msg_type = WRP_MSG_TYPE__AUTH;
	auth_msg_var.u.auth.status = 200;
	
	//Sending success status to clients after each nanomsg registration
	nbytes = wrp_struct_to(&auth_msg_var, WRP_BYTES, &auth_bytes );
        if(nbytes < 0)
        {
                ParodusError(" Failed to encode wrp struct returns %d\n", nbytes);
        }
        else
        {
	        ParodusInfo("Client %s Registered successfully. Sending Acknowledgement... \n ", new_node->service_name);
                size = (size_t) nbytes;
                ParodusInfo("Sending ack:new_node->sock %d service:%s\n", new_node->sock, new_node->service_name);
	        byte = nn_send (new_node->sock, auth_bytes, size, 0);
		
	        if(byte >=0)
	        {
	            ParodusPrint("send registration success status to client\n");
	            status = 0;
	        }
	        else
	        {
	            ParodusError("send registration failed\n");
	        }
        }
	byte = 0;
	size = 0;
	free(auth_bytes);
	auth_bytes = NULL;
	return status;
}
/** To send auth status to clients in list ***/
To send auth status to clients in list
To send auth status to clients in list
int sendAuthStatus(reg_list_item_t *new_node)
{
	int byte = 0, nbytes = -1;	
	size_t size=0;
	void *auth_bytes;
	wrp_msg_t auth_msg_var;
	int status = -1;
	auth_msg_var.msg_type = WRP_MSG_TYPE__AUTH;
	auth_msg_var.u.auth.status = 200;
	nbytes = wrp_struct_to(&auth_msg_var, WRP_BYTES, &auth_bytes );
        if(nbytes < 0)
        {
                ParodusError(" Failed to encode wrp struct returns %d\n", nbytes);
        }
        else
        {
	        ParodusInfo("Client %s Registered successfully. Sending Acknowledgement... \n ", new_node->service_name);
                size = (size_t) nbytes;
                ParodusInfo("Sending ack:new_node->sock %d service:%s\n", new_node->sock, new_node->service_name);
	        byte = nn_send (new_node->sock, auth_bytes, size, 0);
	        if(byte >=0)
	        {
	            ParodusPrint("send registration success status to client\n");
	            status = 0;
	        }
	        else
	        {
	            ParodusError("send registration failed\n");
	        }
        }
	byte = 0;
	size = 0;
	free(auth_bytes);
	auth_bytes = NULL;
	return status;
}
int sendAuthStatus ( reg_list_item_t * new_node ) { int byte = 0 , nbytes = -1 ; size_t size = 0 ; void * auth_bytes ; wrp_msg_t auth_msg_var ; int status = -1 ; auth_msg_var . msg_type = WRP_MSG_TYPE__AUTH ; auth_msg_var . u . auth . status = 200 ; nbytes = wrp_struct_to ( & auth_msg_var , WRP_BYTES , & auth_bytes ) ; if ( nbytes < 0 ) { ParodusError ( " \n " , nbytes ) ; } else { ParodusInfo ( " \n " , new_node -> service_name ) ; size = ( size_t ) nbytes ; ParodusInfo ( " \n " , new_node -> sock , new_node -> service_name ) ; byte = nn_send ( new_node -> sock , auth_bytes , size , 0 ) ; if ( byte >= 0 ) { ParodusPrint ( " \n " ) ; status = 0 ; } else { ParodusError ( " \n " ) ; } } byte = 0 ; size = 0 ; free ( auth_bytes ) ; auth_bytes = NULL ; return status ; }
To send auth status to clients in list
To send auth status to clients in list
//Sending success status to clients after each nanomsg registration