diff --git a/include/types/arg.h b/include/types/arg.h index 96974ba88..6580c1583 100644 --- a/include/types/arg.h +++ b/include/types/arg.h @@ -29,6 +29,7 @@ #include #include +#include /* encoding of each arg type : up to 31 types are supported */ #define ARGT_BITS 5 @@ -60,6 +61,7 @@ enum { ARGT_MAP, /* a pointer to a map descriptor */ ARGT_REG, /* a pointer to a regex */ ARGT_VAR, /* contains a variable description. */ + ARGT_PBUF_FNUM, /* a protocol buffer field number */ /* please update arg_type_names[] in args.c if you add entries here */ }; @@ -100,6 +102,7 @@ union arg_data { struct userlist *usr; struct map_descriptor *map; struct my_regex *reg; + struct pbuf_fid fid; struct var_desc var; }; diff --git a/include/types/protocol_buffers.h b/include/types/protocol_buffers.h new file mode 100644 index 000000000..af5d26214 --- /dev/null +++ b/include/types/protocol_buffers.h @@ -0,0 +1,37 @@ +/* + * include/types/protocol_buffers.h + * This file contains structure declarations for protocol buffers. + * + * Copyright 2012 Willy Tarreau + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, version 2.1 + * exclusively. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef _TYPES_PROTOCOL_BUFFERS_H +#define _TYPES_PROTOCOL_BUFFERS_H + +struct pbuf_fid { + unsigned int *ids; + size_t sz; +}; + +#endif /* _TYPES_PROTOCOL_BUFFERS_H */ + +/* + * Local variables: + * c-indent-level: 8 + * c-basic-offset: 8 + * End: + */ diff --git a/src/arg.c b/src/arg.c index 8e71dcca2..858f8ec54 100644 --- a/src/arg.c +++ b/src/arg.c @@ -35,6 +35,7 @@ const char *arg_type_names[ARGT_NBTYPES] = { [ARGT_MAP] = "map", [ARGT_REG] = "regex", [ARGT_VAR] = "variable", + [ARGT_PBUF_FNUM] = "Protocol buffers field number", /* Unassigned types must never happen. Better crash during parsing if they do. */ }; @@ -239,6 +240,12 @@ int make_arg_list(const char *in, int len, uint64_t mask, struct arg **argp, arg->type = ARGT_SINT; break; + case ARGT_PBUF_FNUM: + if (!parse_dotted_uints(word, &arg->data.fid.ids, &arg->data.fid.sz)) + goto parse_err; + + break; + /* FIXME: other types need to be implemented here */ default: goto not_impl;