 |
Kea
1.5.0
|
Go to the documentation of this file.
27 #include <boost/noncopyable.hpp>
117 return (cfg_option_list_);
122 return (cfg_option_list_);
143 void copyDefaultFields();
154 void copyDefaultOptions();
162 void setHostIdentifiers();
226 Dhcpv4Srv(uint16_t port = DHCP4_SERVER_PORT,
227 const bool use_bcast =
true,
228 const bool direct_response_desired =
true);
235 return (io_service_);
271 bool allow_packet_park =
true);
330 NameChangeSender::Result result,
808 bool sanity_only =
false)
const;
823 bool sanity_only =
false)
const;
982 #endif // DHCP4_SRV_H
This file provides the classes needed to embody, compose, and decompose DNS update requests that are ...
void deferredUnpack(Pkt4Ptr &query)
Perform deferred option unpacking.
boost::shared_ptr< NetworkState > NetworkStatePtr
Pointer to the NetworkState object.
bool useBroadcast() const
Return bool value indicating that broadcast flags should be set on sockets.
static void evaluateClasses(const Pkt4Ptr &pkt, bool depend_on_known)
Evaluate classes.
static int getHookIndexPkt4Receive()
Returns the index for "pkt4_receive" hook point.
static int getHookIndexLease4Decline()
Returns the index for "lease4_decline" hook point.
static const std::string VENDOR_CLASS_PREFIX
this is a prefix added to the content of vendor-class option
void processPacket(Pkt4Ptr &query, Pkt4Ptr &rsp, bool allow_packet_park=true)
Process a single incoming DHCPv4 packet.
void processRelease(Pkt4Ptr &release, AllocEngine::ClientContext4Ptr &context)
Processes incoming DHCPRELEASE messages.
static int getHookIndexPkt4Send()
Returns the index for "pkt4_send" hook point.
Pkt4Ptr processDiscover(Pkt4Ptr &discover)
Processes incoming DISCOVER and returns response.
boost::shared_ptr< Lease4 > Lease4Ptr
Pointer to a Lease4 structure.
static std::string getVersion(bool extended)
returns Kea version on stdout and exit.
boost::shared_ptr< CalloutHandle > CalloutHandlePtr
A shared pointer to a CalloutHandle object.
isc::dhcp::Subnet4Ptr selectSubnet(const Pkt4Ptr &query, bool &drop, bool sanity_only=false) const
Selects a subnet for a given client's packet.
static void appendServerID(Dhcpv4Exchange &ex)
Adds server identifier option to the server's response.
static void sanityCheck(const Pkt4Ptr &query, RequirementLevel serverid)
Verifies if specified packet meets RFC requirements.
Pkt4Ptr processInform(Pkt4Ptr &inform)
Processes incoming DHCPINFORM messages.
isc::dhcp::Subnet4Ptr selectSubnet4o6(const Pkt4Ptr &query, bool &drop, bool sanity_only=false) const
Selects a subnet for a given client's DHCP4o6 packet.
Pkt4Ptr getResponse() const
Returns the pointer to the server's response.
virtual Pkt4Ptr receivePacket(int timeout)
dummy wrapper around IfaceMgr::receive4
boost::shared_ptr< NameChangeRequest > NameChangeRequestPtr
Defines a pointer to a NameChangeRequest.
asiolink::IOServicePtr & getIOService()
Returns pointer to the IO service used by the server.
boost::shared_ptr< Dhcpv4Exchange > Dhcpv4ExchangePtr
Type representing the pointer to the Dhcpv4Exchange.
void deleteResponse()
Removes the response message by resetting the pointer to NULL.
void appendRequestedOptions(Dhcpv4Exchange &ex)
Appends options requested by client.
void setReservedMessageFields()
Sets reserved values of siaddr, sname and file in the server's response.
static int getHookIndexLease4Release()
Returns the index for "lease4_release" hook point.
Base class for all services.
bool acceptDirectRequest(const Pkt4Ptr &query) const
Check if a message sent by directly connected client should be accepted or discarded.
virtual void sendPacket(const Pkt4Ptr &pkt)
dummy wrapper around IfaceMgr::send()
boost::shared_ptr< AllocEngine > alloc_engine_
Allocation Engine.
void initResponse4o6()
Initializes the DHCPv6 part of the response message.
void processDecline(Pkt4Ptr &decline, AllocEngine::ClientContext4Ptr &context)
Process incoming DHCPDECLINE messages.
Dhcpv4Srv(uint16_t port=DHCP4_SERVER_PORT, const bool use_bcast=true, const bool direct_response_desired=true)
Default constructor.
void processPacketBufferSend(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &rsp)
Executes buffer4_send callout and sends the response.
static int getHookIndexSubnet4Select()
Returns the index for "subnet4_select" hook point.
virtual ~Dhcpv4Srv()
Destructor. Used during DHCPv4 service shutdown.
void appendBasicOptions(Dhcpv4Exchange &ex)
Append basic options if they are not present.
Defines the logger used by the top-level component of kea-dhcp-ddns.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
uint16_t getPort() const
Get UDP port on which server should listen.
CfgOptionList & getCfgOptionList()
Returns the configured option list (non-const version)
void shutdown()
Instructs the server to shut down.
static void processStatsSent(const Pkt4Ptr &response)
Updates statistics for transmitted packets.
bool run()
Main server processing loop.
boost::shared_ptr< ClientContext4 > ClientContext4Ptr
Pointer to the ClientContext4.
void processPacketPktSend(hooks::CalloutHandlePtr &callout_handle, Pkt4Ptr &query, Pkt4Ptr &rsp)
Executes pkt4_send callout.
boost::shared_ptr< Subnet4 > Subnet4Ptr
A pointer to a Subnet4 object.
virtual void d2ClientErrorHandler(const dhcp_ddns::NameChangeSender::Result result, dhcp_ddns::NameChangeRequestPtr &ncr)
Implements the error handler for DHCP_DDNS IO errors.
static int getHookIndexBuffer4Receive()
Returns the index for "buffer4_receive" hook point.
static uint16_t checkRelayPort(const Dhcpv4Exchange &ex)
Check if the relay port RAI sub-option was set in the query.
bool acceptServerId(const Pkt4Ptr &pkt) const
Verifies if the server id belongs to our server.
void buildCfgOptionList(Dhcpv4Exchange &ex)
Build the configured option list.
void initResponse()
Initializes the instance of the response message.
const CfgOptionList & getCfgOptionList() const
Returns the configured option list (const version)
void classifyPacket(const Pkt4Ptr &pkt)
Assigns incoming packet to zero or more classes.
static void adjustIfaceData(Dhcpv4Exchange &ex)
Set IP/UDP and interface parameters for the DHCPv4 response.
bool acceptMessageType(const Pkt4Ptr &query) const
Check if received message type is valid for the server to process.
boost::shared_ptr< AllocEngine > AllocEnginePtr
A pointer to the AllocEngine object.
Dhcpv4Exchange(const AllocEnginePtr &alloc_engine, const Pkt4Ptr &query, const Subnet4Ptr &subnet)
Constructor.
Pkt4Ptr getQuery() const
Returns the pointer to the query from the client.
static int getHookIndexBuffer4Send()
Returns the index for "buffer4_send" hook point.
boost::shared_ptr< IOService > IOServicePtr
Defines a smart pointer to an IOService instance.
void processClientName(Dhcpv4Exchange &ex)
Processes Client FQDN and Hostname Options sent by a client.
void assignLease(Dhcpv4Exchange &ex)
Assigns a lease and appends corresponding options.
void setReservedClientClasses()
Assigns classes retrieved from host reservation database.
void renewLease(const Pkt4Ptr &renew, Pkt4Ptr &reply)
Attempts to renew received addresses.
void run_one()
Main server processing step.
static void processStatsReceived(const Pkt4Ptr &query)
Class methods for DHCPv4-over-DHCPv6 handler.
void stopD2()
Stops DHCP_DDNS client IO if DDNS updates are enabled.
void declineLease(const Lease4Ptr &lease, const Pkt4Ptr &decline, AllocEngine::ClientContext4Ptr &context)
Marks lease as declined.
NetworkStatePtr network_state_
Holds information about disabled DHCP service and/or disabled subnet/network scopes.
boost::shared_ptr< Option > OptionPtr
void classifyByVendor(const Pkt4Ptr &pkt)
Assign class using vendor-class-identifier option.
AllocEngine::ClientContext4Ptr getContext() const
Returns the copy of the context for the Allocation engine.
void createNameChangeRequests(const Lease4Ptr &lease, const Lease4Ptr &old_lease)
Creates NameChangeRequests which correspond to the lease which has been acquired.
volatile bool shutdown_
indicates if shutdown is in progress.
static std::string srvidToString(const OptionPtr &opt)
converts server-id to text Converts content of server-id option to a text representation,...
bool accept(const Pkt4Ptr &query) const
Checks whether received message should be processed or discarded.
RequirementLevel
defines if certain option may, must or must not appear
Pkt4Ptr processRequest(Pkt4Ptr &request, AllocEngine::ClientContext4Ptr &context)
Processes incoming REQUEST and returns REPLY response.
void setFixedFields(Dhcpv4Exchange &ex)
Sets fixed fields of the outgoing packet.
void discardPackets()
Discard all in-progress packets.
void startD2()
Starts DHCP_DDNS client IO if DDNS updates are enabled.
static void adjustRemoteAddr(Dhcpv4Exchange &ex)
Sets remote addresses for outgoing packet.
NetworkStatePtr & getNetworkState()
Returns pointer to the network state used by the server.
std::list< ConstCfgOptionPtr > CfgOptionList
Const pointer list.
void requiredClassify(Dhcpv4Exchange &ex)
Assigns incoming packet to zero or more classes (required pass).
void appendRequestedVendorOptions(Dhcpv4Exchange &ex)
Appends requested vendor options as requested by client.