Exemple #1
0
uint32_t PPP_send_stop
   (
      PPP_CFG_PTR       ppp_ptr,
            /* [IN] - PPP handle */
      uint16_t           protocol
            /* [IN] - protocol for the packet */
   )
{ /* Body */
   PPP_MESSAGE_PTR   message;

   message = RTCS_msg_alloc(ppp_ptr->MSG_POOL);
   if (message == NULL) {
      return RTCSERR_PPP_OUT_OF_BUFFERS;
   } /* Endif */

   message->HEADER.SIZE       = sizeof(*message);
   message->HEADER.TARGET_QID = ppp_ptr->MSG_QUEUE;

   message->COMMAND  = PPPCMD_STOP;
   message->PROTOCOL = protocol & 0xFFFF;

   RTCS_msgq_send(message, ppp_ptr->MSG_POOL);

   return PPP_OK;

} /* Endbody */
Exemple #2
0
uint32_t PPP_send_shutdown
   (
      PPP_CFG_PTR       ppp_ptr,
            /* [IN] - PPP handle */
      void             *param
            /* [IN] - parameter for timeout function */
   )
{ /* Body */
   PPP_MESSAGE_PTR   message;

   message = RTCS_msg_alloc(ppp_ptr->MSG_POOL);
   if (message == NULL) {
      return RTCSERR_PPP_OUT_OF_BUFFERS;
   } /* Endif */

   message->HEADER.SIZE       = sizeof(*message);
   message->HEADER.TARGET_QID = ppp_ptr->MSG_QUEUE;

   message->COMMAND  = PPPCMD_SHUTDOWN;
   message->TIMEOUT  = 0;
   message->PARAM    = param;

   RTCS_msgq_send(message, ppp_ptr->MSG_POOL);
   return PPP_OK;

} /* Endbody */
Exemple #3
0
uint_32 PPP_send_one
   (
      PPP_CFG_PTR    ppp_ptr,
            /* [IN] - PPP handle */
      uint_16        protocol,
            /* [IN] - protocol for the packet */
      PCB_PTR        pcb
            /* [IN] - packet */
   )
{ /* Body */
   PPP_MESSAGE_PTR   message;

   message = RTCS_msg_alloc(ppp_ptr->MSG_POOL);
   if (message == NULL) {
      return RTCSERR_PPP_OUT_OF_BUFFERS;
   } /* Endif */

   message->HEADER.SIZE       = sizeof(*message);
   message->HEADER.TARGET_QID = ppp_ptr->MSG_QUEUE;

   message->COMMAND  = PPPCMD_SEND;
   message->PROTOCOL = protocol & 0xFFFF;
   message->PCB      = pcb;
   message->TIMEOUT  = 0;

   RTCS_msgq_send(message, ppp_ptr->MSG_POOL);
   return PPP_OK;

} /* Endbody */
Exemple #4
0
boolean RTCS_cmd_service
   (
      RTCSPCB_PTR       pcb,
      void (_CODE_PTR_  command)(pointer)
   )
{ /* Body */
   RTCS_DATA_PTR        RTCS_data_ptr;
   TCPIP_MESSAGE_PTR    message;

   RTCS_data_ptr = RTCS_get_data();

   message = RTCS_msg_alloc(RTCS_data_ptr->TCPIP_msg_pool);
   if (message == NULL) {
      return FALSE;
   } /* Endif */

   message->HEAD.TARGET_QID = RTCS_data_ptr->TCPIP_qid;
   message->HEAD.SOURCE_QID = 0;
   message->HEAD.SIZE = sizeof(*message);
   message->COMMAND = command;
   message->DATA = pcb;

   return RTCS_msgq_send(message, RTCS_data_ptr->TCPIP_msg_pool);

} /* Endbody */
Exemple #5
0
uint32_t PPP_send_rexmit
   (
      PPP_CFG_PTR       ppp_ptr,
            /* [IN] - PPP handle */
      uint16_t           protocol,
            /* [IN] - protocol for the packet */
      PCB_PTR           pcb,
            /* [IN] - packet */
      uint32_t           retries,
            /* [IN] - maximum number of retries */
      void (_CODE_PTR_  timeout)(void *, PCB_PTR, bool),
            /* [IN] - function to call after max retransmissions */
      void             *param
            /* [IN] - parameter for timeout function */
   )
{ /* Body */
   PPP_MESSAGE_PTR   message;

   message = RTCS_msg_alloc(ppp_ptr->MSG_POOL);
   if (message == NULL) {
      return RTCSERR_PPP_OUT_OF_BUFFERS;
   } /* Endif */

   message->HEADER.SIZE       = sizeof(*message);
   message->HEADER.TARGET_QID = ppp_ptr->MSG_QUEUE;

   message->COMMAND  = PPPCMD_SEND;
   message->PROTOCOL = protocol & 0xFFFF;
   message->PCB      = pcb;
   message->TIMEOUT  = _PPP_MIN_XMIT_TIMEOUT;
   message->RETRY    = retries;
   message->CALL     = timeout;
   message->PARAM    = param;

   RTCS_msgq_send(message, ppp_ptr->MSG_POOL);
   return PPP_OK;

} /* Endbody */
Exemple #6
0
static void _iopcb_hdlc_write
   (
   _iopcb_handle      handle,
   /* [IN] - the handle */
   PCB_PTR            pcb_ptr,
   /* [IN] - the packet */
   uint_32            flags
   /* [IN] - the flags */
   )
{ /* Body */
   RTCS_HDLC_MESSAGE_STRUCT_PTR msg_ptr;
   HDLCIO_STRUCT_PTR            hdlcio_ptr = (HDLCIO_STRUCT_PTR)((void _PTR_)handle);
   uint_32                      data_length = 0;
   uint_32                      i = 0;
   uint_32                      j = 0;
   _RTCS_queueid                qid;

   while (pcb_ptr->FRAG[i].LENGTH && (data_length <= RTCS_HDLC_MESSAGE_SIZE)) {
      data_length += pcb_ptr->FRAG[i].LENGTH;
      i++;
   } /* Endwhile */
   i = 0;

   if ( data_length > RTCS_HDLC_MESSAGE_SIZE ) {
      PCB_free(pcb_ptr);
      return;
   }/* Endif */

   hdlcio_ptr->STATS.COMMON.ST_TX_TOTAL++;
   msg_ptr = (RTCS_HDLC_MESSAGE_STRUCT_PTR)RTCS_msg_alloc(hdlcio_ptr->POOL_ID);
   if (msg_ptr == NULL) {
      /* Free the PCB and return */
      hdlcio_ptr->STATS.COMMON.ST_TX_MISSED++;
      PCB_free(pcb_ptr);
      return;
   } /* Endif */

   /* assemble message to send */
   qid = RTCS_msgq_get_id(0, hdlcio_ptr->CHANNEL_Q);
   msg_ptr->HDLC_HEADER.HEADER.TARGET_QID = qid;
   msg_ptr->HDLC_HEADER.HEADER.SOURCE_QID = hdlcio_ptr->QID;
   msg_ptr->HDLC_HEADER.HEADER.SIZE = sizeof(RTCS_HDLC_MESSAGE_STRUCT)
      + data_length + 2;
   msg_ptr->HDLC_HEADER.PACKET_SIZE = data_length + 2;

   /* Add address and control bytes */
   msg_ptr->DATA[0] = 0xFF;
   msg_ptr->DATA[1] = 0x03;
   j+=2;



   while (pcb_ptr->FRAG[i].LENGTH) {
      RTCS_memcopy(pcb_ptr->FRAG[i].FRAGMENT, &msg_ptr->DATA[j],
         pcb_ptr->FRAG[i].LENGTH);
      j += pcb_ptr->FRAG[i].LENGTH;
      i++;
   } /* Endwhile */

   PCB_free(pcb_ptr);

   if (!RTCS_msgq_send(msg_ptr, hdlcio_ptr->POOL_ID)) {
      hdlcio_ptr->STATS.COMMON.ST_TX_MISSED++;
   } /* Endif */ ;

} /* Endbody */