Example #1
0
static void
pgr_handler(vector_t *strvec)
{
	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
	if (vs->addr.ss_family == AF_INET6)
		vs->granularity_persistence = atoi(vector_slot(strvec, 1));
	else
		inet_ston(vector_slot(strvec, 1), &vs->granularity_persistence);
}
Example #2
0
static void
pgr_handler(vector strvec)
{
	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
	inet_ston(VECTOR_SLOT(strvec, 1), &vs->granularity_persistence);
}
Example #3
0
static void
natmask_handler(vector_t *strvec)
{
	virtual_server_t *vs = LIST_TAIL_DATA(check_data->vs);
	inet_ston(vector_slot(strvec, 1), &vs->nat_mask);
}
Example #4
0
static void
natmask_handler(vector strvec)
{
	virtual_server *vs = LIST_TAIL_DATA(check_data->vs);
	inet_ston(VECTOR_SLOT(strvec, 1), &vs->nat_mask);
}
Example #5
0
static void
vrrp_mcastip_handler(vector_t *strvec)
{
	vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
	inet_ston(vector_slot(strvec, 1), &vrrp->saddr);
}
static void
vrrp_mcastip_handler(vector strvec)
{
	vrrp_rt *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
	inet_ston(VECTOR_SLOT(strvec, 1), &vrrp->mcast_saddr);
}
Example #7
0
/* Command line parser */
static int
parse_cmdline(int argc, char **argv, REQ * req_obj)
{
	poptContext context;
	char *optarg = NULL;
	int c;

	struct poptOption options_table[] = {
		{"release", 'r', POPT_ARG_NONE, NULL, 'r'},
		{"help", 'h', POPT_ARG_NONE, NULL, 'h'},
		{"verbose", 'v', POPT_ARG_NONE, NULL, 'v'},
		{"use-ssl", 'S', POPT_ARG_NONE, NULL, 'S'},
		{"server", 's', POPT_ARG_STRING, &optarg, 's'},
		{"port", 'p', POPT_ARG_STRING, &optarg, 'p'},
		{"url", 'u', POPT_ARG_STRING, &optarg, 'u'},
		{"use-virtualhost", 'V', POPT_ARG_STRING, &optarg, 'V'},
		{NULL, 0, 0, NULL, 0}
	};

	/* Parse the command line arguments */
	context =
	    poptGetContext(PROG, argc, (const char **) argv, options_table, 0);
	if ((c = poptGetNextOpt(context)) < 0) {
		usage(argv[0]);
		return CMD_LINE_ERROR;
	}

	/* The first option car */
	switch (c) {
	case 'r':
		fprintf(stderr, VERSION_STRING);
		break;
	case 'h':
		usage(argv[0]);
		break;
	case 'v':
		req_obj->verbose = 1;
		break;
	case 'S':
		req_obj->ssl = 1;
		break;
	case 's':
		inet_ston(optarg, &req_obj->addr_ip);
		break;
	case 'V':
		req_obj->vhost = optarg;
		break;
	default:
		usage(argv[0]);
		return CMD_LINE_ERROR;
	}

	/* the others */
	while ((c = poptGetNextOpt(context)) >= 0) {
		switch (c) {
		case 'v':
			req_obj->verbose = 1;
			break;
		case 'S':
			req_obj->ssl = 1;
			break;
		case 's':
			inet_ston(optarg, &req_obj->addr_ip);
			break;
		case 'V':
			req_obj->vhost = optarg;
			break;
		case 'p':
			req_obj->addr_port = htons(atoi(optarg));
			break;
		case 'u':
			req_obj->url = optarg;
			break;
		default:
			usage(argv[0]);
			return CMD_LINE_ERROR;
		}
	}

	/* check unexpected arguments */
	if ((optarg = (char *) poptGetArg(context))) {
		fprintf(stderr, "unexpected argument %s", optarg);
		return CMD_LINE_ERROR;
	}

	/* free the allocated context */
	poptFreeContext(context);

	return CMD_LINE_SUCCESS;
}
Example #8
0
/* Command line parser */
static int
parse_cmdline(int argc, char **argv, REQ * req_obj)
{
	int c;
	enum feat_hashes i;

	struct option long_options[] = {
		{"release",         no_argument,       0, 'r'},
		{"help",            no_argument,       0, 'h'},
		{"verbose",         no_argument,       0, 'v'},
		{"use-ssl",         no_argument,       0, 'S'},
		{"server",          optional_argument, 0, 's'},
		{"hash",            optional_argument, 0, 'H'},
		{"use-virtualhost", optional_argument, 0, 'V'},
		{"port",            optional_argument, 0, 'p'},
		{"url",             optional_argument, 0, 'u'},
		{0, 0, 0, 0}
	};

	/* Parse the command line arguments */
	while ((c = getopt_long (argc, argv, "rhvSs:H:V:p:u:", long_options, NULL)) != EOF) {
		switch (c) {
		case 'r':
			fprintf(stderr, VERSION_STRING);
			break;
		case 'h':
			usage(argv[0]);
			break;
		case 'v':
			req_obj->verbose = 1;
			break;
		case 'S':
			req_obj->ssl = 1;
			break;
		case 's':
			if (!inet_ston(optarg, &req_obj->addr_ip)) {
				fprintf(stderr, "server should be an IP, not %s\n", optarg);
				return CMD_LINE_ERROR;
			}
			break;
		case 'H':
			for (i = hash_first; i < hash_guard; i++)
				if (!strcasecmp(optarg, hashes[i].id)) {
					req_obj->hash = i;
					break;
				}
			if (i == hash_guard) {
				fprintf(stderr, "unknown hash algoritm: %s\n", optarg);
				return CMD_LINE_ERROR;
			}
			break;
		case 'V':
			req_obj->vhost = optarg;
			break;
		case 'p':
			req_obj->addr_port = htons(atoi(optarg));
			break;
		case 'u':
			req_obj->url = optarg;
			break;
		default:
			usage(argv[0]);
			return CMD_LINE_ERROR;
		}
	}

	/* check unexpected arguments */
	if (optind < argc) {
		fprintf(stderr, "Unexpected argument(s): ");
		while (optind < argc)
			printf("%s ", argv[optind++]);
		printf("\n");
		return CMD_LINE_ERROR;
	}

	return CMD_LINE_SUCCESS;
}