4 # Copyright (C) 2005,2006 Mathieu Ignacio -- mignacio@april.org
6 # This file is part of pydhcplib.
7 # Pydhcplib is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with this program; if not, write to the Free Software
19 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
21 from pydhcplib.dhcp_packet import *
22 from pydhcplib.dhcp_network import *
25 netopt = {'client_listen_port':68,
26 'server_listen_port':67,
27 'listen_address':"0.0.0.0"}
29 class Client(DhcpClient):
30 def __init__(self, options):
31 DhcpClient.__init__(self,options["listen_address"],
32 options["client_listen_port"],
33 options["server_listen_port"])
35 def HandleDhcpOffer(self, packet):
39 def HandleDhcpAck(self, packet):
43 def HandleDhcpNack(self, packet):
48 client = Client(netopt)
51 client.GetNextDhcpPacket()