X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/0a1a2873858e2559d46ee2bcbc9926bb09a8f3d4..69cb46af9119e8b5554bcc4bf1bf36f39cb82131:/print-radius.c diff --git a/print-radius.c b/print-radius.c index 2c7456bb..02d6a599 100644 --- a/print-radius.c +++ b/print-radius.c @@ -48,7 +48,6 @@ * TODO: Among other things to print ok MacIntosh and Vendor values */ -#define NETDISSECT_REWORKED #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -162,12 +161,12 @@ static const struct tok rfc4675_tagged[] = { }; -static void print_attr_string(netdissect_options *, register u_char *, u_int, u_short ); -static void print_attr_num(netdissect_options *, register u_char *, u_int, u_short ); -static void print_vendor_attr(netdissect_options *, register u_char *, u_int, u_short ); -static void print_attr_address(netdissect_options *, register u_char *, u_int, u_short); -static void print_attr_time(netdissect_options *, register u_char *, u_int, u_short); -static void print_attr_strange(netdissect_options *, register u_char *, u_int, u_short); +static void print_attr_string(netdissect_options *, register const u_char *, u_int, u_short ); +static void print_attr_num(netdissect_options *, register const u_char *, u_int, u_short ); +static void print_vendor_attr(netdissect_options *, register const u_char *, u_int, u_short ); +static void print_attr_address(netdissect_options *, register const u_char *, u_int, u_short); +static void print_attr_time(netdissect_options *, register const u_char *, u_int, u_short); +static void print_attr_strange(netdissect_options *, register const u_char *, u_int, u_short); struct radius_hdr { uint8_t code; /* Radius packet code */ @@ -369,7 +368,7 @@ struct attrtype { const char *name; /* Attribute name */ const char **subtypes; /* Standard Values (if any) */ u_char siz_subtypes; /* Size of total standard values */ u_char first_subtype; /* First standard value is 0 or 1 */ - void (*print_func)(netdissect_options *, register u_char *, u_int, u_short); + void (*print_func)(netdissect_options *, register const u_char *, u_int, u_short); } attr_type[]= { { NULL, NULL, 0, 0, NULL }, @@ -390,7 +389,7 @@ struct attrtype { const char *name; /* Attribute name */ { "Login-Service", login_serv, TAM_SIZE(login_serv), 0, print_attr_num }, { "Login-TCP-Port", NULL, 0, 0, print_attr_num }, { "Unassigned", NULL, 0, 0, NULL }, /*17*/ - { "Reply-Message", NULL, 0, 0, print_attr_string }, + { "Reply-Message", NULL, 0, 0, print_attr_string }, { "Callback-Number", NULL, 0, 0, print_attr_string }, { "Callback-Id", NULL, 0, 0, print_attr_string }, { "Unassigned", NULL, 0, 0, NULL }, /*21*/ @@ -478,7 +477,7 @@ struct attrtype { const char *name; /* Attribute name */ /*****************************/ static void print_attr_string(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code) + register const u_char *data, u_int length, u_short attr_code) { register u_int i; @@ -546,7 +545,7 @@ print_attr_string(netdissect_options *ndo, */ static void print_vendor_attr(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code _U_) + register const u_char *data, u_int length, u_short attr_code _U_) { u_int idx; u_int vendor_id; @@ -611,7 +610,7 @@ print_vendor_attr(netdissect_options *ndo, /******************************/ static void print_attr_num(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code) + register const u_char *data, u_int length, u_short attr_code) { uint32_t timeout; @@ -734,7 +733,7 @@ print_attr_num(netdissect_options *ndo, /*****************************/ static void print_attr_address(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code) + register const u_char *data, u_int length, u_short attr_code) { if (length != 4) { @@ -778,7 +777,7 @@ print_attr_address(netdissect_options *ndo, /*************************************/ static void print_attr_time(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code _U_) + register const u_char *data, u_int length, u_short attr_code _U_) { time_t attr_time; char string[26]; @@ -811,7 +810,7 @@ print_attr_time(netdissect_options *ndo, /***********************************/ static void print_attr_strange(netdissect_options *ndo, - register u_char *data, u_int length, u_short attr_code) + register const u_char *data, u_int length, u_short attr_code) { u_short len_data; @@ -884,7 +883,7 @@ static void radius_attrs_print(netdissect_options *ndo, register const u_char *attr, u_int length) { - register const struct radius_attr *rad_attr = (struct radius_attr *)attr; + register const struct radius_attr *rad_attr = (const struct radius_attr *)attr; const char *attr_string; while (length > 0) @@ -924,16 +923,16 @@ radius_attrs_print(netdissect_options *ndo, { if ( attr_type[rad_attr->type].print_func ) (*attr_type[rad_attr->type].print_func)( - ndo, ((u_char *)(rad_attr+1)), + ndo, ((const u_char *)(rad_attr+1)), rad_attr->len - 2, rad_attr->type); } } /* do we also want to see a hex dump ? */ if (ndo->ndo_vflag> 1) - print_unknown_data(ndo, (u_char *)rad_attr+2, "\n\t ", (rad_attr->len)-2); + print_unknown_data(ndo, (const u_char *)rad_attr+2, "\n\t ", (rad_attr->len)-2); length-=(rad_attr->len); - rad_attr = (struct radius_attr *)( ((char *)(rad_attr))+rad_attr->len); + rad_attr = (const struct radius_attr *)( ((const char *)(rad_attr))+rad_attr->len); } return; @@ -949,7 +948,7 @@ radius_print(netdissect_options *ndo, u_int len, auth_idx; ND_TCHECK2(*dat, MIN_RADIUS_LEN); - rad = (struct radius_hdr *)dat; + rad = (const struct radius_hdr *)dat; len = EXTRACT_16BITS(&rad->len); if (len < MIN_RADIUS_LEN)