Exemple #1
0
/* ************************************************** */
void rx(call_t *c, packet_t *packet) {
   struct nodedata *nodedata = get_node_private_data(c);
   struct data_d_header *header = (struct data_d_header *) (packet->data + nodedata->overhead);
    
   switch (header->type) {       

   case XY_HELLO_TYPE:
        /* for us */
       rx_xy_hello(c, packet);
       break;       

   case XY_DATA_TYPE:
        /* for us */
       rx_xy_data(c, packet);
       break;       
   case XY_REQUEST_TYPE:
        /* for us */
       rx_xy_request(c, packet);
       break;       
   case XY_RESPONSE_TYPE:
        /* for us */
       rx_xy_response(c, packet);
       break;       

   case SOURCE_ADV_TYPE:
        /* for us */
        rx_source_adv(c, packet);
        break;
   case SOURCE_DATA_TYPE:
        /* for us */
        rx_source_data(c, packet);
        break;
   case SINK_ADV_TYPE:
        /* for us */
       rx_sink_adv(c, packet);
       break;

   default:
       /* not for us */
       packet_dealloc(packet);
       break;
   }
   
    return;
}
Exemple #2
0
void rx(call_t *c, packet_t *packet) {
    struct nodedata *nodedata = get_node_private_data(c);
    struct data_d_header *header = (struct data_d_header *) (packet->data + nodedata->overhead);

    switch (header->type) {
    case SOURCE_ADV_TYPE:
        /* for us */
        rx_source_adv(c, packet);
        break;
    case SENSOR_ADV_TYPE:
        /* not for us */
        packet_dealloc(packet);
        break;
    case SOURCE_DATA_TYPE:
        /* for us */
        rx_source_data(c, packet);
        break;
    case SINK_ADV_TYPE:
        /* for us */
        rx_sink_adv(c, packet);
        break;
    case SENSOR_DATA_TYPE:
       /* not for us */
        packet_dealloc(packet);
        break;
    case HOME_ADV_TYPE:
        /* not for us */
        packet_dealloc(packet);
        break;
    case GOSSIP_DATA_TYPE:
        /* for us */
        rx_gossip_data(c, packet);
        break;
    default:
        /* not for us */
        packet_dealloc(packet);
        break;
    }

    return;
}