///////////////////////////////////////////////////////////////////////////////
// Request the deletion of a classifier rule
//---------------------------------------------------------------------------
void nasmt_set_msg_class_del_reply(struct nas_msg_class_del_reply *msgrep, struct nas_msg_class_del_request *msgreq)
{
  //---------------------------------------------------------------------------
  if (msgreq->dscp>NAS_DSCP_DEFAULT) {
    printk("nasmt_set_msg_class_del_reply: Incoherent parameter value\n");
    msgrep->status=-NAS_ERROR_NOTCORRECTDSCP;
    return;
  }

  if (msgreq->dir==NAS_DIRECTION_SEND) {
    struct cx_entity *cx;
    cx=nasmt_COMMON_search_cx(msgreq->lcr);

    if (cx!=NULL)
      nasmt_CLASS_del_sclassifier(cx, msgreq->dscp, msgreq->classref);
    else {
      msgrep->status=-NAS_ERROR_NOTCORRECTLCR;
      return;
    }
  } else {
    if (msgreq->dir==NAS_DIRECTION_RECEIVE)
      nasmt_CLASS_del_rclassifier(msgreq->dscp, msgreq->classref);
    else {
      msgrep->status=-NAS_ERROR_NOTCORRECTDIR;
      return;
    }
  }

  msgrep->status=0;
}
Exemplo n.º 2
0
//---------------------------------------------------------------------------
// free the memory that has previously been allocated to rb and remove from linked list
void nasmt_COMMON_del_rb(struct cx_entity *cx, nasRadioBearerId_t rab_id, nasIPdscp_t dscp){
//---------------------------------------------------------------------------
  struct rb_entity *rb, *curr_rb, *prev_rb;
  struct classifier_entity *p;
  u16 classref=0;

// Start debug information
#ifdef GRAAL_DEBUG_CLASS
  printk("nasmt_COMMON_del_rb - begin\n");
#endif
  if (cx==NULL){
    printk("nasmt_COMMON_del_rb - input parameter cx is NULL \n");
    return;
  }
// End debug information

// Clear the associated classifier
  for (p=cx->sclassifier[dscp]; p!=NULL; p=p->next){
    if (p->classref>=classref){
      classref=p->classref;
      #ifdef GRAAL_DEBUG_CLASS
      printk("nasmt_COMMON_del_rb: classifier found for dscp %u \n", dscp);
      #endif
    }
  }
  nasmt_CLASS_del_sclassifier(cx, dscp, classref);

// Now, delete the RB
  curr_rb = NULL;
  prev_rb = NULL;
  for (rb=cx->rb; rb!=NULL; rb=rb->next){
    if (rb->rab_id == rab_id){
      curr_rb = rb;
      if (prev_rb!=NULL){
        prev_rb->next = rb->next;
      }else{
        cx->rb=rb->next;
      }
      break;
    }else{
      prev_rb = rb;
    }
  }
  if (curr_rb!= NULL){
    printk("nasmt_COMMON_del_rb: del rab_id %u\n", rb->rab_id);
    kfree(rb);
    (cx->num_rb)--;
  }else{
    printk("\n\n--nasmt_COMMON_del_rb: ERROR, invalid rab_id %u\n", rb->rab_id);
  }
#ifdef GRAAL_DEBUG_CLASS
  printk("nasmt_COMMON_del_rb - end\n");
#endif
}