31                            const std::string& id_val_str,
 
   32                            const std::string& addr_str,
 
   33                            const bool& registered);
 
   83        uint8_t packet_type = response->getType();
 
   85            std::cout << 
"DHCP UserCheckHook : pkt4_send" 
   86                      << 
"skipping packet type: " 
   87                      << 
static_cast<int>(packet_type) << std::endl;
 
  102        if (registered_user) {
 
  105            std::cout << 
"DHCP UserCheckHook : pkt4_send registered_user is: " 
  106                      << registered_user->getUserId() << std::endl;
 
  115            std::cout << 
"DHCP UserCheckHook : pkt4_send no registered_user" 
  123    } 
catch (
const std::exception& ex) {
 
  124        std::cout << 
"DHCP UserCheckHook : pkt4_send unexpected error: " 
  125                  << ex.what() << std::endl;
 
 
  165        if (addr_str.empty()) {
 
  167            std::cout << 
"pkt6_send: Skipping packet address is blank" 
  180        if (registered_user) {
 
  183            std::cout << 
"DHCP UserCheckHook : pkt6_send registered_user is: " 
  184                      << registered_user->getUserId() << std::endl;
 
  192            std::cout << 
"DHCP UserCheckHook : pkt6_send no registered_user" 
  199    } 
catch (
const std::exception& ex) {
 
  200        std::cout << 
"DHCP UserCheckHook : pkt6_send unexpected error: " 
  201                  << ex.what() << std::endl;
 
 
  228    std::string opt_value = user->getProperty(
"bootfile");
 
  229    if (!opt_value.empty()) {
 
  230        std::cout << 
"DHCP UserCheckHook : add4Options " 
  231              << 
"adding boot file:" << opt_value << std::endl;
 
  237        response->setFile((
const uint8_t*)(opt_value.c_str()),
 
  242    opt_value = user->getProperty(
"tftp_server");
 
  243    if (!opt_value.empty()) {
 
  244        std::cout << 
"DHCP UserCheckHook : add4Options " 
  245              << 
"adding TFTP server:" << opt_value << std::endl;
 
 
  260    OptionPtr opt = response->getOption(opt_code);
 
  262        response->delOption(opt_code);
 
  267    response->addOption(opt);
 
 
  291        std::cout << 
"DHCP UserCheckHook : add6Options " 
  292              << 
"response has no vendor option to update" << std::endl;
 
  297    std::string opt_value = user->getProperty(
"bootfile");
 
  298    if (!opt_value.empty()) {
 
  299        std::cout << 
"DHCP UserCheckHook : add6Options " 
  300                  << 
"adding boot file:" << opt_value << std::endl;
 
  305    opt_value = user->getProperty(
"tftp_server");
 
  306    if (!opt_value.empty()) {
 
  307        std::cout << 
"DHCP UserCheckHook : add6Options " 
  308                  << 
"adding tftp server:" << opt_value << std::endl;
 
 
  322    vendor->delOption(opt_code);
 
  324    vendor->addOption(option);
 
 
  374                            const std::string& id_val_str,
 
  375                            const std::string& addr_str,
 
  376                            const bool& registered)
 
  379                    << 
"client=" << id_val_str << std::endl
 
  380                    << 
"addr=" << addr_str << std::endl
 
  381                    << 
"registered=" << (registered ? 
"yes" : 
"no")
 
 
  429    boost::shared_ptr<Option6IA> ia =
 
  430        boost::dynamic_pointer_cast<Option6IA>(options);
 
  438        return (std::string(
""));
 
  446    boost::shared_ptr<Option6IAAddr> addr_option;
 
  447    addr_option  = boost::dynamic_pointer_cast<Option6IAAddr>(options);
 
 
  468    boost::shared_ptr<Option6IA> ia =
 
  469        boost::dynamic_pointer_cast<Option6IA>(options);
 
  480        return (std::string(
""));
 
  489    boost::shared_ptr<Option6IAPrefix> addr_option;
 
  490    addr_option = boost::dynamic_pointer_cast<Option6IAPrefix>(options);
 
  497    uint8_t prefix_len = addr_option->getLength();
 
  501    buf << addr.
toText() << 
"/" << 
static_cast<int>(prefix_len);
 
 
  517            boost::dynamic_pointer_cast
 
  522        int status_val = status->readInteger<uint16_t>(0);
 
  523        if (status_val != 0) {
 
  524            std::cout << 
"SKIPPING PACKET STATUS is not success:" 
  525                      << status_val << std::endl;
 
 
CalloutNextStep
Specifies allowed next steps.
@ NEXT_STEP_DROP
drop the packet
@ NEXT_STEP_SKIP
skip the next processing step
A generic exception that is thrown if a parameter given to a method is considered invalid in that con...
A generic exception that is thrown if a function is called in a prohibited way.
The IOAddress class represents an IP addresses (version agnostic)
std::string toText() const
Convert the address to a string.
Option with defined data fields represented as buffers that can be accessed using data field index.
Class which represents an option carrying a single string value.
Per-packet callout handle.
void getContext(const std::string &name, T &value) const
Get context.
CalloutNextStep getStatus() const
Returns the next processing step.
void getArgument(const std::string &name, T &value) const
Get argument.
Encapsulates a unique identifier for a DHCP client.
static const char * DUID_STR
Define the text label DUID id type.
static const char * HW_ADDRESS_STR
Defines the text label hardware address id type.
@ HW_ADDRESS
Hardware addresses (MAC) are used for IPv4 clients.
@ DUID
DUIDs are used for IPv6 clients.
#define DOCSIS3_V6_TFTP_SERVERS
#define DOCSIS3_V6_CONFIG_FILE
#define isc_throw(type, stream)
A shortcut macro to insert known values into exception arguments.
boost::shared_ptr< OptionCustom > OptionCustomPtr
A pointer to the OptionCustom object.
boost::shared_ptr< Pkt4 > Pkt4Ptr
A pointer to Pkt4 object.
boost::shared_ptr< DUID > DuidPtr
boost::shared_ptr< HWAddr > HWAddrPtr
Shared pointer to a hardware address structure.
boost::shared_ptr< Pkt6 > Pkt6Ptr
A pointer to Pkt6 packet.
boost::shared_ptr< Option > OptionPtr
Defines the logger used by the user check hooks library.
boost::shared_ptr< User > UserPtr
Defines a smart pointer to a User.
void add6Options(Pkt6Ptr &response, const UserPtr &user)
Adds IPv6 vendor options to the response packet based on given user.
bool checkIAStatus(boost::shared_ptr< Option6IA > &ia_opt)
Tests given IA option set for successful status.
void generate_output_record(const std::string &id_type_str, const std::string &id_val_str, const std::string &addr_str, const bool ®istered)
Adds an entry to the end of the user check outcome file.
std::string getAddrStrIA_NA(OptionPtr options)
Stringify the lease address in an D6O_IA_NA option set.
std::string getAddrStrIA_PD(OptionPtr options)
Stringify the lease prefix in an D6O_IA_PD option set.
void add6Option(OptionPtr &vendor, uint8_t opt_code, std::string &opt_value)
Adds/updates a specific IPv6 string vendor option.
const UserPtr & getDefaultUser4()
Fetches the default IPv4 user from the registry.
const UserPtr & getDefaultUser6()
Fetches the default IPv6 user from the registry.
int pkt6_send(CalloutHandle &handle)
This callout is called at the "pkt6_send" hook.
int pkt4_send(CalloutHandle &handle)
This callout is called at the "pkt4_send" hook.
std::string getV6AddrStr(Pkt6Ptr response)
Stringify the lease address or prefix IPv6 response packet.
void add4Option(Pkt4Ptr &response, uint8_t opt_code, std::string &opt_value)
Adds/updates are specific IPv4 string option in response packet.
void add4Options(Pkt4Ptr &response, const UserPtr &user)
Adds IPv4 options to the response packet based on given user.
const char * query_user_id_label
Text label of user id in the inbound query in callout context.
std::fstream user_chk_output
Output filestream for recording user check outcomes.
UserRegistryPtr user_registry
Pointer to the registry instance.
const char * default_user4_id_str
Text id used to identify the default IPv4 user in the registry The format is a string containing an e...
const char * registered_user_label
Text label of registered user pointer in callout context.
const char * default_user6_id_str
Text id used to identify the default IPv6 user in the registry The format is a string containing an e...