예제 #1
0
/**
\brief Indicates a packet has been sent.

\param[in,out] msg   The packet just sent.
\param[in]     error The outcome of sending it.
*/
void forwarding_sendDone(OpenQueueEntry_t* msg, owerror_t error) {
   
   // take ownership
   msg->owner = COMPONENT_FORWARDING;
   
   if (msg->creator==COMPONENT_RADIO || msg->creator==COMPONENT_FORWARDING) {
      // this is a relayed packet
      
      // free packet
      openqueue_freePacketBuffer(msg);
   } else {
      // this is a packet created by this mote
      
      // indicate sendDone to upper layer
      switch(msg->l4_protocol) {
         case IANA_TCP:
            opentcp_sendDone(msg,error);
            break;
         case IANA_UDP:
            openudp_sendDone(msg,error);
            break;
         case IANA_ICMPv6:
            icmpv6_sendDone(msg,error);
            break;
         default:
            
            // log error
            openserial_printCritical(
               COMPONENT_FORWARDING,
               ERR_WRONG_TRAN_PROTOCOL,
               (errorparameter_t)msg->l4_protocol,
               (errorparameter_t)0
            );
            
            // free packet
            openqueue_freePacketBuffer(msg);
      }
   }
}
예제 #2
0
void forwarding_sendDone(OpenQueueEntry_t* msg, error_t error) {
  msg->owner = COMPONENT_FORWARDING;
  if (msg->creator==COMPONENT_RADIO || msg->creator==COMPONENT_FORWARDING) {//that was a packet I had relayed
    openqueue_freePacketBuffer(msg);
  } else {//that was a packet coming from above
    switch(msg->l4_protocol) {
    case IANA_TCP:
      opentcp_sendDone(msg,error);
      break;
    case IANA_UDP:
      openudp_sendDone(msg,error);
      break;
    case IANA_ICMPv6:
      icmpv6_sendDone(msg,error);
      break;
    default:
      openserial_printError(COMPONENT_FORWARDING,ERR_WRONG_TRAN_PROTOCOL,
                            (errorparameter_t)msg->l4_protocol,
                            (errorparameter_t)0);
      // free the corresponding packet buffer
      openqueue_freePacketBuffer(msg);
    }
  }
}