static int conf_cmdline(struct mip6_config *cfg, int argc, char **argv) { static struct option long_opts[] = { {"version", 0, 0, 'V'}, {"help", 0, 0, 'h'}, {"correspondent-node", 0, 0, 'C'}, {"home-agent", 0, 0, 'H'}, {"mobile-node", 0, 0, 'M'}, {"show-config", 0, 0, 0}, #ifdef ENABLE_VT {"vt-service", 1, 0, 0 }, #endif {0, 0, 0, 0} }; /* parse all other cmd line parameters than -c */ while (1) { int idx, c; c = getopt_long(argc, argv, "c:d:l:Vh?CMH", long_opts, &idx); if (c == -1) break; switch (c) { case 0: #ifdef ENABLE_VT if (strcmp(long_opts[idx].name, "vt-service") == 0) { cfg->vt_service = optarg; break; } #endif if (idx == 5) conf_show(cfg); return -1; case 'V': conf_version(); return -1; case '?': case 'h': conf_usage(basename(argv[0])); return -1; case 'd': cfg->debug_level = atoi(optarg); break; case 'l': cfg->debug_log_file = optarg; break; case 'C': cfg->mip6_entity = MIP6_ENTITY_CN; break; case 'H': cfg->mip6_entity = MIP6_ENTITY_HA; break; case 'M': cfg->mip6_entity = MIP6_ENTITY_MN; break; default: break; }; } return 0; }
static int conf_cmdline(struct mip6_config *cfg, int argc, char **argv) { static struct option long_opts[] = { {"version", 0, 0, 'V'}, {"help", 0, 0, 'h'}, {"correspondent-node", 0, 0, 'C'}, {"home-agent", 0, 0, 'H'}, {"mobile-node", 0, 0, 'M'}, {"mobile-access-gateway", optional_argument, 0, 'm'}, {"local-mobility-anchor", optional_argument, 0, 'a'}, {"pmip-tunneling", optional_argument, 0, 'i'}, {"pmip-dyn-tunneling", optional_argument, 0, 'd'}, {"lma-address", optional_argument, 0, 'L'}, {"mag-ingress-address", optional_argument, 0, 'N'}, {"mag-egress-address", optional_argument, 0, 'E'}, {"show-config", 0, 0, 0}, {"radius-client-cfg-file", optional_argument, 0, 'R'}, {"radius-password", 0, 0, 'P'}, #ifdef ENABLE_VT {"vt-service", 1, 0, 0 }, #endif {0, 0, 0, 0} }; /* parse all other cmd line parameters than -c */ while (1) { int idx, c; c = getopt_long(argc, argv, "c:d:l:L:N:E:R:P:Vh?CMHmaip", long_opts, &idx); if (c == -1) break; switch (c) { case 0: #ifdef ENABLE_VT if (strcmp(long_opts[idx].name, "vt-service") == 0) { cfg->vt_service = optarg; break; } #endif if (idx == 5) conf_show(cfg); return -1; case 'V': conf_version(); return -1; case '?': case 'h': conf_usage(basename(argv[0])); return -1; case 'd': cfg->debug_level = atoi(optarg); break; case 'l': cfg->debug_log_file = optarg; break; case 'C': cfg->mip6_entity = MIP6_ENTITY_CN; break; case 'H': cfg->mip6_entity = MIP6_ENTITY_HA; break; case 'M': cfg->mip6_entity = MIP6_ENTITY_MN; break; case 'L': if (strchr(optarg, ':')) { if (inet_pton(AF_INET6, optarg, (char *) &cfg->LmaAddress) <= 0) { fprintf(stderr, "invalid address %s\n", optarg); exit(2); } } break; case 'N': if (strchr(optarg, ':')) { if (inet_pton(AF_INET6, optarg, (char *) &cfg->MagAddressIngress) <= 0) { fprintf(stderr, "invalid address %s\n", optarg); exit(2); } } break; case 'E': if (strchr(optarg, ':')) { if (inet_pton(AF_INET6, optarg, (char *) &cfg->MagAddressEgress) <= 0) { fprintf(stderr, "invalid address %s\n", optarg); exit(2); } } break; case 'm': cfg->mip6_entity = MIP6_ENTITY_MAG; break; case 'a': cfg->mip6_entity = MIP6_ENTITY_LMA; break; case 'i': cfg->TunnelingEnabled = 1; break; case 'p': cfg->DynamicTunnelingEnabled = 1; break; case 'R': cfg->RadiusClientConfigFile = optarg; break; case 'P': cfg->RadiusPassword = optarg; break; default: break; }; } return 0; }