4 # Copyright (C) 2005 Mathieu Ignacio -- mignacio@april.org
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 2 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program; if not, write to the Free Software
18 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
20 from pydhcplib.dhcp_packet import *
21 from pydhcplib.dhcp_network import *
24 netopt = {'client_listen_port':"68",
25 'server_listen_port':"67",
26 'listen_address':"0.0.0.0"}
28 class Server(DhcpServer):
29 def __init__(self, options):
30 DhcpServer.__init__(self,options["listen_address"],
31 options["client_listen_port"],
32 options["server_listen_port"])
34 def HandleDhcpDiscover(self, packet):
38 def HandleDhcpRequest(self, packet):
42 def HandleDhcpDecline(self, packet):
46 def HandleDhcpRelease(self, packet):
50 def HandleDhcpInform(self, packet):
56 server = Server(netopt)
59 server.GetNextDhcpPacket()