DHCP options parsing and reassembly. */
/*
- * Copyright (c) 1995, 1996 The Internet Software Consortium.
+ * Copyright (c) 1995, 1996, 1998 The Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
#ifndef lint
static char copyright[] =
-"$Id: options.c,v 1.27 1998/02/06 01:18:33 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: options.c,v 1.28 1998/03/16 06:19:46 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#define DHCP_OPTION_DATA
if (packet -> options_valid
&& packet -> options [DHO_DHCP_OPTION_OVERLOAD].data) {
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 1)
- parse_option_buffer (packet,
- packet -> raw -> file,
- sizeof packet -> raw -> file);
+ parse_option_buffer
+ (packet,
+ (unsigned char *)packet -> raw -> file,
+ sizeof packet -> raw -> file);
if (packet -> options [DHO_DHCP_OPTION_OVERLOAD].data [0] & 2)
- parse_option_buffer (packet,
- packet -> raw -> sname,
- sizeof packet -> raw -> sname);
+ parse_option_buffer
+ (packet,
+ (unsigned char *)packet -> raw -> sname,
+ sizeof packet -> raw -> sname);
}
}
case 't':
if (emit_quotes)
*op++ = '"';
- strcpy (op, dp);
- op += strlen (dp);
+ strcpy (op, (char *)dp);
+ op += strlen ((char *)dp);
if (emit_quotes)
*op++ = '"';
*op = 0;
struct interface_info *interface;
unsigned char *packbuf;
int len;
- unsigned short from_port;
+ unsigned int from_port;
struct iaddr from;
struct hardware *hfrom;
{
Definitions for dhcpd... */
/*
- * Copyright (c) 1995, 1996, 1997 The Internet Software Consortium.
+ * Copyright (c) 1995, 1996, 1997, 1998 The Internet Software Consortium.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
unsigned char *, int, int, int));
void do_packet PROTO ((struct interface_info *,
unsigned char *, int,
- unsigned short, struct iaddr, struct hardware *));
+ unsigned int, struct iaddr, struct hardware *));
/* errwarn.c */
extern int warnings_occurred;
void dhcpdecline PROTO ((struct packet *));
void dhcpinform PROTO ((struct packet *));
void nak_lease PROTO ((struct packet *, struct iaddr *cip));
-void ack_lease PROTO ((struct packet *, struct lease *, unsigned char, TIME));
+void ack_lease PROTO ((struct packet *, struct lease *, unsigned int, TIME));
void dhcp_reply PROTO ((struct lease *));
struct lease *find_lease PROTO ((struct packet *,
struct shared_network *, int *));
extern struct protocol *protocols;
extern int quiet_interface_discovery;
extern void (*bootp_packet_handler) PROTO ((struct interface_info *,
- unsigned char *, int, unsigned short,
+ unsigned char *, int, unsigned int,
struct iaddr, struct hardware *));
extern struct timeout *timeouts;
void discover_interfaces PROTO ((int));
/* hash.c */
struct hash_table *new_hash PROTO ((void));
-void add_hash PROTO ((struct hash_table *, char *, int, unsigned char *));
-void delete_hash_entry PROTO ((struct hash_table *, char *, int));
-unsigned char *hash_lookup PROTO ((struct hash_table *, char *, int));
+void add_hash PROTO ((struct hash_table *,
+ unsigned char *, int, unsigned char *));
+void delete_hash_entry PROTO ((struct hash_table *, unsigned char *, int));
+unsigned char *hash_lookup PROTO ((struct hash_table *, unsigned char *, int));
/* tables.c */
extern struct option dhcp_options [256];
int16_t getShort PROTO ((unsigned char *));
void putULong PROTO ((unsigned char *, u_int32_t));
void putLong PROTO ((unsigned char *, int32_t));
-void putUShort PROTO ((unsigned char *, u_int16_t));
-void putShort PROTO ((unsigned char *, int16_t));
+void putUShort PROTO ((unsigned char *, u_int32_t));
+void putShort PROTO ((unsigned char *, int32_t));
/* inet.c */
struct iaddr subnet_number PROTO ((struct iaddr, struct iaddr));
void assemble_hw_header PROTO ((struct interface_info *, unsigned char *,
int *, struct hardware *));
void assemble_udp_ip_header PROTO ((struct interface_info *, unsigned char *,
- int *, u_int32_t, u_int32_t, u_int16_t,
+ int *, u_int32_t, u_int32_t, u_int32_t,
unsigned char *, int));
ssize_t decode_hw_header PROTO ((struct interface_info *, unsigned char *,
int, struct hardware *));
/* dhcrelay.c */
void relay PROTO ((struct interface_info *, u_int8_t *, int,
- unsigned short, struct iaddr, struct hardware *));
+ unsigned int, struct iaddr, struct hardware *));
/* icmp.c */
void icmp_startup PROTO ((int, void (*) PROTO ((struct iaddr,
#ifndef lint
static char copyright[] =
-"$Id: dhcp.c,v 1.58 1998/02/06 01:08:38 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
+"$Id: dhcp.c,v 1.59 1998/03/16 06:18:03 mellon Exp $ Copyright (c) 1995, 1996 The Internet Software Consortium. All rights reserved.\n";
#endif /* not lint */
#include "dhcpd.h"
int outstanding_pings;
-static unsigned char dhcp_message [256];
+static char dhcp_message [256];
void dhcp (packet)
struct packet *packet;
/* Set DHCP_MESSAGE to whatever the message is */
options [DHO_DHCP_MESSAGE] = &dhcpmsg_tree;
- options [DHO_DHCP_MESSAGE] -> value = dhcp_message;
- options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message);
- options [DHO_DHCP_MESSAGE] -> buf_size = strlen (dhcp_message);
+ options [DHO_DHCP_MESSAGE] -> value = (unsigned char *)dhcp_message;
+ options [DHO_DHCP_MESSAGE] -> buf_size =
+ options [DHO_DHCP_MESSAGE] -> len = strlen (dhcp_message);
options [DHO_DHCP_MESSAGE] -> timeout = 0xFFFFFFFF;
options [DHO_DHCP_MESSAGE] -> tree = (struct tree *)0;
-
+
/* Do not use the client's requested parameter list. */
packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].len = 0;
packet -> options [DHO_DHCP_PARAMETER_REQUEST_LIST].data =
void ack_lease (packet, lease, offer, when)
struct packet *packet;
struct lease *lease;
- unsigned char offer;
+ unsigned int offer;
TIME when;
{
struct lease lt;
if (packet -> options [DHO_DHCP_CLASS_IDENTIFIER].len) {
vendor_class =
find_class (0,
- packet ->
+ (char *)packet ->
options [DHO_DHCP_CLASS_IDENTIFIER].data,
packet ->
options [DHO_DHCP_CLASS_IDENTIFIER].len);
if (packet -> options [DHO_DHCP_USER_CLASS_ID].len) {
user_class =
find_class (1,
- packet ->
+ (char *)packet ->
options [DHO_DHCP_USER_CLASS_ID].data,
packet ->
options [DHO_DHCP_USER_CLASS_ID].len);