Exemplo n.º 1
0
///////////////////////////////////////////////////////////////////////////////
// Connection Establishment
//---------------------------------------------------------------------------
void nas_set_msg_cx_establishment_reply(struct nas_msg_cx_establishment_reply *msgrep,
                                        struct nas_msg_cx_establishment_request *msgreq,
                                        struct nas_priv *priv)
{
  //---------------------------------------------------------------------------

  struct cx_entity *cx;
  cx=nas_COMMON_search_cx(msgreq->lcr,priv);

  if (cx!=NULL) {
    cx->cellid=msgreq->cellid;
    msgrep->status=nas_mesh_DC_send_cx_establish_request(cx,priv);
  } else
    msgrep->status=-NAS_ERROR_NOTCORRECTLCR;

}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
void nas_mesh_timer(unsigned long data)
{
  //---------------------------------------------------------------------------
  struct nas_priv *gpriv=(struct nas_priv *) data;
  uint8_t cxi;
  struct cx_entity *cx;
  struct rb_entity *rb;
  //  spin_lock(&gpriv->lock);
#ifdef NAS_DEBUG_TIMER
  printk("NAS_MESH_TIMER - begin \n");
#endif

  (gpriv->timer).function=nas_mesh_timer;
  (gpriv->timer).expires=jiffies+NAS_TIMER_TICK;
  (gpriv->timer).data=data;

  return;


  for (cxi=0; cxi<NAS_CX_MAX; ++cxi) {
    cx=gpriv->cx+cxi;

    if (cx==NULL) {
#ifdef NAS_DEBUG_TIMER
      printk("NAS_MESH_TIMER - No pointer for connection %d \n", cxi);
#endif
      continue;
    }

    if (cx->countimer!=NAS_TIMER_IDLE) {
#ifdef NAS_DEBUG_TIMER
      printk("NAS_MESH_TIMER: lcr %u, countimer %u\n", cx->lcr, cx->countimer);
#endif

      if (cx->countimer==0) {
        switch (cx->state) {
        case NAS_CX_CONNECTING:
        case NAS_CX_CONNECTING_FAILURE:
          if (cx->retry<gpriv->retry_limit)
            nas_mesh_DC_send_cx_establish_request(cx,gpriv);
          else {
            printk("NAS_MESH_TIMER: Establishment failure\n");
            cx->state=NAS_IDLE;
            cx->retry=0;
            cx->countimer=NAS_TIMER_IDLE;
          }

          break;

        case NAS_CX_RELEASING_FAILURE:
          nas_mesh_DC_send_cx_release_request(cx,gpriv);
          break;

        default:
          printk("NAS_MESH_TIMER: default value\n");
          cx->countimer=NAS_TIMER_IDLE;
        }
      } else
        --cx->countimer;
    }

    for (rb=cx->rb; rb!=NULL; rb=rb->next) {
      if (rb->countimer!=NAS_TIMER_IDLE) {
#ifdef NAS_DEBUG_TIMER
        printk("NAS_MESH_TIMER : rb countimer %d, rb state %d\n", rb->countimer, rb->state);
#endif

        if (rb->countimer==0) {
          switch (rb->state) {
          case NAS_RB_DCH:
            nas_mesh_start_default_sclassifier(cx, rb);
            rb->countimer=NAS_TIMER_IDLE;
            break;

          default:
            rb->countimer=NAS_TIMER_IDLE;
          }
        } else {
          --rb->countimer;
          printk("NAS_MESH_TIMER : rb countimer-- %d, rb state %d\n", rb->countimer, rb->state);
        }
      }
    }
  }

  //  add_timer(&gpriv->timer);
  //  spin_unlock(&gpriv->lock);
}