summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjasper <jasper@openbsd.org>2016-01-15 10:14:32 +0000
committerjasper <jasper@openbsd.org>2016-01-15 10:14:32 +0000
commit26f19e833517620fd866d2ef3b1ea76ece6924c5 (patch)
tree44e55589fcc4a588961799ec7d1d1fd6ea3a34fe
parentwhen enabling the controller, wait till CSTS.RDY lights up. (diff)
downloadwireguard-openbsd-26f19e833517620fd866d2ef3b1ea76ece6924c5.tar.xz
wireguard-openbsd-26f19e833517620fd866d2ef3b1ea76ece6924c5.zip
Add support for parsing 'hyper' and 'quad' types, as per RFC4506.
From FreeBSD ok millert@
-rw-r--r--usr.bin/rpcgen/rpc_parse.c12
-rw-r--r--usr.bin/rpcgen/rpc_scan.c4
-rw-r--r--usr.bin/rpcgen/rpc_scan.h4
3 files changed, 17 insertions, 3 deletions
diff --git a/usr.bin/rpcgen/rpc_parse.c b/usr.bin/rpcgen/rpc_parse.c
index 1b7e68fa897..a209eee27db 100644
--- a/usr.bin/rpcgen/rpc_parse.c
+++ b/usr.bin/rpcgen/rpc_parse.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_parse.c,v 1.19 2015/08/20 22:32:41 deraadt Exp $ */
+/* $OpenBSD: rpc_parse.c,v 1.20 2016/01/15 10:14:32 jasper Exp $ */
/* $NetBSD: rpc_parse.c,v 1.5 1995/08/29 23:05:55 cgd Exp $ */
/*
@@ -571,6 +571,10 @@ get_type(prefixp, typep, dkind)
*typep = "long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ *typep = "int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_VOID:
if (dkind != DEF_UNION && dkind != DEF_PROGRAM) {
error("voids allowed only inside union and program definitions with one argument");
@@ -583,6 +587,7 @@ get_type(prefixp, typep, dkind)
case TOK_INT:
case TOK_FLOAT:
case TOK_DOUBLE:
+ case TOK_QUAD:
case TOK_BOOL:
*typep = tok.str;
break;
@@ -613,6 +618,11 @@ unsigned_dec(typep)
*typep = "u_long";
(void) peekscan(TOK_INT, &tok);
break;
+ case TOK_HYPER:
+ get_token(&tok);
+ *typep = "u_int64_t";
+ (void) peekscan(TOK_INT, &tok);
+ break;
case TOK_INT:
get_token(&tok);
*typep = "u_int";
diff --git a/usr.bin/rpcgen/rpc_scan.c b/usr.bin/rpcgen/rpc_scan.c
index 2ce4851655f..5f9af3c45e1 100644
--- a/usr.bin/rpcgen/rpc_scan.c
+++ b/usr.bin/rpcgen/rpc_scan.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_scan.c,v 1.18 2015/08/20 22:32:41 deraadt Exp $ */
+/* $OpenBSD: rpc_scan.c,v 1.19 2016/01/15 10:14:32 jasper Exp $ */
/* $NetBSD: rpc_scan.c,v 1.4 1995/06/11 21:50:02 pk Exp $ */
/*
@@ -407,8 +407,10 @@ static token symbols[] = {
{TOK_UNSIGNED, "unsigned"},
{TOK_SHORT, "short"},
{TOK_LONG, "long"},
+ {TOK_HYPER, "hyper"},
{TOK_FLOAT, "float"},
{TOK_DOUBLE, "double"},
+ {TOK_QUAD, "quadruple"},
{TOK_STRING, "string"},
{TOK_PROGRAM, "program"},
{TOK_VERSION, "version"},
diff --git a/usr.bin/rpcgen/rpc_scan.h b/usr.bin/rpcgen/rpc_scan.h
index f3878dcd00a..7f21471e499 100644
--- a/usr.bin/rpcgen/rpc_scan.h
+++ b/usr.bin/rpcgen/rpc_scan.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: rpc_scan.h,v 1.5 2010/09/01 14:43:34 millert Exp $ */
+/* $OpenBSD: rpc_scan.h,v 1.6 2016/01/15 10:14:32 jasper Exp $ */
/* $NetBSD: rpc_scan.h,v 1.3 1995/06/11 21:50:04 pk Exp $ */
/*
@@ -69,9 +69,11 @@ enum tok_kind {
TOK_INT,
TOK_SHORT,
TOK_LONG,
+ TOK_HYPER,
TOK_UNSIGNED,
TOK_FLOAT,
TOK_DOUBLE,
+ TOK_QUAD,
TOK_OPAQUE,
TOK_CHAR,
TOK_STRING,