Update of /cvsroot/dhcp-agent/dhcp-agent/src
In directory sc8-pr-cvs1:/tmp/cvs-serv18210/src
Modified Files:
dhcp-server.h
Added Files:
dhcp-server-states.c
Log Message:
server code now has states
--- NEW FILE: dhcp-server-states.c ---
/* $Header: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server-states.c,v 1.1 2003/07/08 07:03:33 actmodern Exp $
*
* Copyright 2002 Thamer Alharbash <tm...@wh...>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
* 3. The names of the authors may not be used to endorse or promote
* products derived from this software without specific prior
* written permission.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
* These are the individual client state functions,
* along with their utility routines.
*
*/
#define MODULE_NAME "dhcp-server-states"
#include "dhcp-local.h"
#include "dhcp-limits.h"
#include "dhcp-libutil.h"
#include "dhcp-librawnet.h"
#include "dhcp-server-conf.h"
#include "dhcp-server.h"
/***************************
* server states *
***************************/
int server_shutdown(dhcp_server_control_t *sc)
{
if(sc) { /* only cleanup if we can. */
INFO_MESSAGE("shutting down");
/* delete the PID file. */
file_delete_pid(sc->interface);
}
exit(0);
}
Index: dhcp-server.h
===================================================================
RCS file: /cvsroot/dhcp-agent/dhcp-agent/src/dhcp-server.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** dhcp-server.h 5 Jul 2003 19:17:48 -0000 1.2
--- dhcp-server.h 8 Jul 2003 07:03:33 -0000 1.3
***************
*** 1,5 ****
/* $Header$
*
! * Copyright 2002 Thamer Alharbash <tm...@wh...>
*
* Redistribution and use in source and binary forms, with or without
--- 1,5 ----
/* $Header$
*
! * Copyright 2003 Thamer Alharbash <tm...@wh...>
*
* Redistribution and use in source and binary forms, with or without
***************
*** 26,36 ****
#define DHCP_SERVER_H
- /* type definitions. */
- typedef void (*server_command) (char *interface);
-
typedef struct {
rawnet_t *rawnet; /* raw network handle */
! char *interface_name; /* name of interface */
server_conf_t *server_conf; /* server configuration. */
--- 26,33 ----
#define DHCP_SERVER_H
typedef struct {
rawnet_t *rawnet; /* raw network handle */
! char *interface; /* name of interface */
server_conf_t *server_conf; /* server configuration. */
***************
*** 38,47 ****
--- 35,52 ----
} dhcp_server_control_t;
+ /* type definitions. */
+ typedef void (*server_command) (char *interface);
+ typedef int (*server_state) (dhcp_server_control_t *);
+
/* constants. */
enum command_codes { DO_VERSION = 0, DO_KILL, DO_STATUS, DO_SERVER };
+ enum server_states { STATE_LISTEN, STATE_SHUTDOWN = 0 };
/* prototypes. */
extern dhcp_server_control_t *dhcp_server_control_create(const char *interface);
+ extern void dhcp_server_control_destroy(dhcp_server_control_t *sc);
+
+ extern int server_shutdown(dhcp_server_control_t *sc);
#endif /* DHCP_SERVER_H */
|