Mercurial > hg > dhcpcd
changeset 27:6b6fb3350708 draft
Make the consts sane
| author | Roy Marples <roy@marples.name> |
|---|---|
| date | Thu, 14 Dec 2006 23:47:56 +0000 |
| parents | f700e79e9497 |
| children | 0d5ccf61c062 |
| files | Makefile arp.c arp.h client.c client.h dhcp.c dhcp.h interface.h signals.c signals.h socket.c socket.h |
| diffstat | 12 files changed, 25 insertions(+), 22 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Thu Dec 14 23:17:27 2006 +0000 +++ b/Makefile Thu Dec 14 23:47:56 2006 +0000 @@ -8,8 +8,7 @@ -Wmissing-declarations -Wno-missing-prototypes -Wwrite-strings \ -Wbad-function-cast -Wnested-externs -Wcomment -Winline \ -Wchar-subscripts -Wcast-align -Wno-format-nonliteral \ - -Wsequence-point -Wextra -# -Wdeclaration-after-statement + -Wsequence-point -Wextra -Werror DESTDIR = SBINDIR = $(DESTDIR)/sbin
--- a/arp.c Thu Dec 14 23:17:27 2006 +0000 +++ b/arp.c Thu Dec 14 23:47:56 2006 +0000 @@ -59,7 +59,7 @@ #define arphdr_len(ap) (arphdr_len2 ((ap)->ar_hln, (ap)->ar_pln)) #endif -int arp_check (interface_t *iface, const struct in_addr address) +int arp_check (interface_t *iface, struct in_addr address) { if (! iface->arpable) {
--- a/arp.h Thu Dec 14 23:17:27 2006 +0000 +++ b/arp.h Thu Dec 14 23:47:56 2006 +0000 @@ -24,6 +24,6 @@ #include "interface.h" -int arp_check (interface_t *iface, const struct in_addr address); +int arp_check (interface_t *iface, struct in_addr address); #endif
--- a/client.c Thu Dec 14 23:17:27 2006 +0000 +++ b/client.c Thu Dec 14 23:47:56 2006 +0000 @@ -123,7 +123,7 @@ /* This state machine is based on the one from udhcpc written by Russ Dill */ -int dhcp_run (options_t *options) +int dhcp_run (const options_t *options) { interface_t *iface; int mode = SOCKET_CLOSED;
--- a/client.h Thu Dec 14 23:17:27 2006 +0000 +++ b/client.h Thu Dec 14 23:47:56 2006 +0000 @@ -24,6 +24,6 @@ #include "dhcpcd.h" -int dhcp_run (options_t *options); +int dhcp_run (const options_t *options); #endif
--- a/dhcp.c Thu Dec 14 23:17:27 2006 +0000 +++ b/dhcp.c Thu Dec 14 23:47:56 2006 +0000 @@ -52,8 +52,9 @@ [DHCP_INFORM + 1] = NULL }; -size_t send_message (interface_t *iface, dhcp_t *dhcp, - unsigned long xid, char type, options_t *options) +size_t send_message (const interface_t *iface, const dhcp_t *dhcp, + unsigned long xid, char type, + const options_t *options) { dhcpmessage_t message; unsigned char *m = (unsigned char *) &message; @@ -454,7 +455,7 @@ } } -int parse_dhcpmessage (dhcp_t *dhcp, dhcpmessage_t *message) +int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message) { unsigned char *p = message->options; unsigned char option;
--- a/dhcp.h Thu Dec 14 23:17:27 2006 +0000 +++ b/dhcp.h Thu Dec 14 23:47:56 2006 +0000 @@ -194,9 +194,10 @@ dhcpmessage_t dhcp; }; -size_t send_message (interface_t *iface, dhcp_t *dhcp, - unsigned long xid, char type, options_t *options); +size_t send_message (const interface_t *iface, const dhcp_t *dhcp, + unsigned long xid, char type, + const options_t *options); void free_dhcp (dhcp_t *dhcp); -int parse_dhcpmessage (dhcp_t *dhcp, dhcpmessage_t *message); +int parse_dhcpmessage (dhcp_t *dhcp, const dhcpmessage_t *message); #endif
--- a/interface.h Thu Dec 14 23:17:27 2006 +0000 +++ b/interface.h Thu Dec 14 23:47:56 2006 +0000 @@ -76,9 +76,9 @@ int flush_addresses (const char *ifname); int add_route (const char *ifname, struct in_addr destination, - struct in_addr netmask, struct in_addr gateway, int metric); + struct in_addr netmask, struct in_addr gateway, int metric); int change_route (const char *ifname, struct in_addr destination, struct in_addr netmask, struct in_addr gateway, int metric); int del_route (const char *ifname, struct in_addr destination, - struct in_addr netmask, struct in_addr gateway, int metric); + struct in_addr netmask, struct in_addr gateway, int metric); #endif
--- a/signals.c Thu Dec 14 23:17:27 2006 +0000 +++ b/signals.c Thu Dec 14 23:47:56 2006 +0000 @@ -77,7 +77,7 @@ /* Read a signal from the signal pipe. Returns 0 if there is * no signal, -1 on error (and sets errno appropriately), and * your signal on success */ -int signal_read (fd_set *rfds) +int signal_read (const fd_set *rfds) { int sig;
--- a/signals.h Thu Dec 14 23:17:27 2006 +0000 +++ b/signals.h Thu Dec 14 23:47:56 2006 +0000 @@ -22,6 +22,6 @@ void signal_setup (void); int signal_fd_set (fd_set *rfds, int extra_fd); -int signal_read (fd_set *rfds); +int signal_read (const fd_set *rfds); #endif
--- a/socket.c Thu Dec 14 23:17:27 2006 +0000 +++ b/socket.c Thu Dec 14 23:47:56 2006 +0000 @@ -77,7 +77,7 @@ } void make_dhcp_packet(struct udp_dhcp_packet *packet, - unsigned char *data, int length, + const unsigned char *data, int length, struct in_addr source, struct in_addr dest) { struct ip *ip = &packet->ip; @@ -441,7 +441,8 @@ return fd; } -int send_packet (interface_t *iface, int type, unsigned char *data, int len) +int send_packet (const interface_t *iface, const int type, + const unsigned char *data, const int len) { struct sockaddr_ll sll; int retval; @@ -465,7 +466,7 @@ /* Linux has no need for the buffer as we can read as much as we want. We only have the buffer listed to keep the same API. */ -int get_packet (interface_t *iface, unsigned char *data, +int get_packet (const interface_t *iface, unsigned char *data, unsigned char *buffer, int *buffer_len, int *buffer_pos) { long bytes;
--- a/socket.h Thu Dec 14 23:17:27 2006 +0000 +++ b/socket.h Thu Dec 14 23:47:56 2006 +0000 @@ -29,11 +29,12 @@ #include "interface.h" void make_dhcp_packet(struct udp_dhcp_packet *packet, - unsigned char *data, int length, + const unsigned char *data, int length, struct in_addr source, struct in_addr dest); int open_socket (interface_t *iface, bool arp); -int send_packet (interface_t *iface, int type, unsigned char *data, int len); -int get_packet (interface_t *iface, unsigned char *data, +int send_packet (const interface_t *iface, int type, + const unsigned char *data, int len); +int get_packet (const interface_t *iface, unsigned char *data, unsigned char *buffer, int *buffer_len, int *buffer_pos); #endif
