print-bootp.c (3229) | print-bootp.c (13572) |
---|---|
1/* 2 * Copyright (c) 1988-1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 9 unchanged lines hidden (view full) --- 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Format and print bootp packets. 22 * 23 * This file was copied from tcpdump-2.1.1 and modified. 24 * There is an e-mail list for tcpdump: <tcpdump@ee.lbl.gov> 25 */ | 1/* 2 * Copyright (c) 1988-1990 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that: (1) source code distributions 7 * retain the above copyright notice and this paragraph in its entirety, (2) 8 * distributions including binary code include the above copyright notice and --- 9 unchanged lines hidden (view full) --- 18 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF 19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 20 * 21 * Format and print bootp packets. 22 * 23 * This file was copied from tcpdump-2.1.1 and modified. 24 * There is an e-mail list for tcpdump: <tcpdump@ee.lbl.gov> 25 */ |
26#ifndef lint 27static char rcsid[] = "$Id: print-bootp.c,v 1.1.1.1 1994/09/10 14:44:55 csgr Exp $"; 28/* 93/10/10 <gwr@mc.com> New data-driven option print routine. */ 29#endif | |
30 31#include <stdio.h> 32 33#include <sys/param.h> 34#include <sys/types.h> 35#include <sys/socket.h> | 26 27#include <stdio.h> 28 29#include <sys/param.h> 30#include <sys/types.h> 31#include <sys/socket.h> |
32 33#ifdef _AIX32 34#include <sys/time.h> /* for struct timeval in net/if.h */ 35#endif |
|
36#include <net/if.h> 37#include <netinet/in.h> | 36#include <net/if.h> 37#include <netinet/in.h> |
38 |
|
38#include <string.h> 39#include <ctype.h> 40 41#include "bootp.h" 42#include "bootptest.h" 43 44/* These decode the vendor data. */ | 39#include <string.h> 40#include <ctype.h> 41 42#include "bootp.h" 43#include "bootptest.h" 44 45/* These decode the vendor data. */ |
46extern int printfn(); |
|
45static void rfc1048_print(); 46static void cmu_print(); 47static void other_print(); 48static void dump_hex(); 49 50/* 51 * Print bootp requests 52 */ --- 213 unchanged lines hidden (view full) --- 266 "iXW-FS", /* 48: X Window System Font Servers */ 267 "iXW-DM", /* 49: X Window System Display Managers */ 268 269 /* DHCP extensions (RFC-1533, sect. 9) */ 270#endif 271}; 272#define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0])) 273 | 47static void rfc1048_print(); 48static void cmu_print(); 49static void other_print(); 50static void dump_hex(); 51 52/* 53 * Print bootp requests 54 */ --- 213 unchanged lines hidden (view full) --- 268 "iXW-FS", /* 48: X Window System Font Servers */ 269 "iXW-DM", /* 49: X Window System Display Managers */ 270 271 /* DHCP extensions (RFC-1533, sect. 9) */ 272#endif 273}; 274#define KNOWN_OPTIONS (sizeof(rfc1048_opts) / sizeof(rfc1048_opts[0])) 275 |
274static void print_string(); 275 | |
276static void 277rfc1048_print(bp, length) 278 register u_char *bp; 279 int length; 280{ 281 u_char tag; 282 u_char *ep; | 276static void 277rfc1048_print(bp, length) 278 register u_char *bp; 279 int length; 280{ 281 u_char tag; 282 u_char *ep; |
283 register int len, j; | 283 register int len; |
284 u_int32 ul; 285 u_short us; 286 struct in_addr ia; 287 char *optstr; 288 289 printf("-rfc1395"); 290 291 /* Step over magic cookie */ --- 136 unchanged lines hidden (view full) --- 428 429static void 430other_print(bp, length) 431 register u_char *bp; 432 int length; 433{ 434 u_char *ep; /* end pointer */ 435 u_char *zp; /* points one past last non-zero byte */ | 284 u_int32 ul; 285 u_short us; 286 struct in_addr ia; 287 char *optstr; 288 289 printf("-rfc1395"); 290 291 /* Step over magic cookie */ --- 136 unchanged lines hidden (view full) --- 428 429static void 430other_print(bp, length) 431 register u_char *bp; 432 int length; 433{ 434 u_char *ep; /* end pointer */ 435 u_char *zp; /* points one past last non-zero byte */ |
436 register int i, j; | |
437 438 /* Setup end pointer */ 439 ep = bp + length; 440 441 /* Find the last non-zero byte. */ 442 for (zp = ep; zp > bp; zp--) { 443 if (zp[-1] != 0) 444 break; --- 49 unchanged lines hidden --- | 436 437 /* Setup end pointer */ 438 ep = bp + length; 439 440 /* Find the last non-zero byte. */ 441 for (zp = ep; zp > bp; zp--) { 442 if (zp[-1] != 0) 443 break; --- 49 unchanged lines hidden --- |