From 22ca8afd659932f05317c9cf1b1815ba9860d34b Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Fri, 4 Feb 2005 02:29:41 +0000 Subject: [PATCH] Parse MCS_TAG_DOMAIN_PARAMS if the length is right. --- mcs.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/mcs.c b/mcs.c index 4a8fc3f..f6a945a 100644 --- a/mcs.c +++ b/mcs.c @@ -89,6 +89,14 @@ ber_out_integer(STREAM s, int value) out_uint16_be(s, value); } +static void +ber_in_integer(STREAM s, int *value) +{ + int length; + ber_parse_header(s, BER_TAG_INTEGER, &length); + in_uint16_be(s, *value); +} + /* Output a DOMAIN_PARAMS structure (ASN.1 BER) */ static void mcs_out_domain_params(STREAM s, int max_channels, int max_users, int max_tokens, int max_pdusize) @@ -109,10 +117,33 @@ static BOOL mcs_parse_domain_params(STREAM s) { int length; + int max_channels, max_users, max_tokens, max_pdusize; + int num_priorities, min_throughput, max_height; + int ver_protocol; ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length); - in_uint8s(s, length); - + printf("MCS_TAG_DOMAIN_PARAMS, len %u (expected 32)\n", length); + if (length == 32) { + ber_in_integer(s, &max_channels); + ber_in_integer(s, &max_users); + ber_in_integer(s, &max_tokens); + ber_in_integer(s, &num_priorities); + ber_in_integer(s, &min_throughput); + ber_in_integer(s, &max_height); + ber_in_integer(s, &max_pdusize); + ber_in_integer(s, &ver_protocol); + + printf("max_channels=%u\n", max_channels); + printf("max_users=%u\n", max_users); + printf("max_tokens=%u\n", max_tokens); + printf("num_priorities=%u\n", num_priorities); + printf("min_throughput=%u\n", min_throughput); + printf("max_pdusize=%u\n", max_pdusize); + printf("ver_protocol=%u\n", ver_protocol); + } else { + in_uint8s(s, length); + } + return s_check(s); } -- 2.39.2