NwGtpv1uRcT
nwGtpv1uInitialize( NW_INOUT NwGtpv1uStackHandleT *hGtpuStackHandle, uint32_t stackType)
{
  NwGtpv1uRcT rc = NW_GTPV1U_FAILURE;
  NwGtpv1uStackT *thiz;

  thiz = (NwGtpv1uStackT *) malloc( sizeof(NwGtpv1uStackT));
  memset(thiz, 0, sizeof(NwGtpv1uStackT));

  if(thiz) {
    thiz->id    = (NwPtrT)thiz;
    thiz->stackType = stackType;
    thiz->seq   = (uint16_t) ((uint32_t)thiz) ; // FIXME interesting casts... don't know what this is good for...
    RB_INIT(&(thiz->outstandingTxSeqNumMap));
    RB_INIT(&(thiz->outstandingRxSeqNumMap));
    RB_INIT(&(thiz->sessionMap));
    RB_INIT(&(thiz->teidMap));

    if (0 == 1) {
      nwGtpv1uDisplayBanner();
    }

    rc = NW_GTPV1U_OK;
  } else {
    rc = NW_GTPV1U_FAILURE;
  }


  *hGtpuStackHandle = (NwGtpv1uStackHandleT) thiz;
  return rc;
}
예제 #2
0
int config_parse_opt_line(int argc, char *argv[], mme_config_t *mme_config_p)
{
  int c;
  mme_config_init(mme_config_p);

  /* Parsing command line */
  while ((c = getopt (argc, argv, "O:c:hi:K:v:V")) != -1) {
    switch (c) {
    case 'O':
    case 'c': {
      /* Store the given configuration file. If no file is given,
       * then the default values will be used.
       */
      int config_file_len = 0;
      config_file_len = strlen(optarg);
      mme_config_p->config_file = malloc(sizeof(char) * (config_file_len + 1));
      memcpy(mme_config_p->config_file, optarg, config_file_len);
      mme_config_p->config_file[config_file_len] = '\0';
    }
    break;

    case 'v': {
      mme_config_p->verbosity_level = atoi(optarg);
    }
    break;

    case 'V': {
      fprintf(stdout, "==== EURECOM %s v%s ====\n"
              "Please report any bug to: %s\n", PACKAGE_NAME, PACKAGE_VERSION,
              PACKAGE_BUGREPORT);
      exit(0);
      nwGtpv1uDisplayBanner();
    }
    break;

    case 'K':
      mme_config_p->itti_config.log_file = strdup(optarg);
      break;

    case 'h': /* Fall through */
    default:
      usage();
      exit(0);
    }
  }

  /* Parse the configuration file using libconfig */
  if (config_parse_file(mme_config_p) != 0) {
    return -1;
  }

  /* Display the configuration */
  config_display(mme_config_p);
  return 0;
}