Kea 2.7.1
user_chk::User Class Reference

Represents a unique DHCP user This class is used to represent a specific DHCP user who is identified by a unique id and who possesses a set of properties. More...

#include <user.h>

Public Member Functions

 User (const UserId &user_id)
 Constructor.
 
 User (UserId::UserIdType id_type, const std::string &id_str)
 Constructor.
 
 User (UserId::UserIdType id_type, const std::vector< uint8_t > &id)
 Constructor.
 
 ~User ()
 Destructor.
 
void delProperty (const std::string &name)
 Removes the given property from the property map.
 
const PropertyMapgetProperties () const
 Returns a reference to the map of properties.
 
std::string getProperty (const std::string &name) const
 Fetches the string value for a given property name.
 
const UserIdgetUserId () const
 Returns the user's id.
 
void setProperties (const PropertyMap &properties)
 Sets the user's properties from a given property map.
 
void setProperty (const std::string &name, const std::string &value)
 Sets a given property to the given value.
 

Detailed Description

Represents a unique DHCP user This class is used to represent a specific DHCP user who is identified by a unique id and who possesses a set of properties.

Definition at line 150 of file user.h.

Constructor & Destructor Documentation

◆ User() [1/3]

user_chk::User::User ( const UserId & user_id)

Constructor.

Constructs a new User from a given id with an empty set of properties.

Parameters
user_idId to assign to the user
Exceptions
isc::BadValueif user id is blank.

Definition at line 155 of file user.cc.

◆ User() [2/3]

user_chk::User::User ( UserId::UserIdType id_type,
const std::vector< uint8_t > & id )

Constructor.

Constructs a new User from a given id type and vector containing the id data with an empty set of properties.

Parameters
id_typeType of id contained in the id vector
idVector of data representing the user's id
Exceptions
isc::BadValueif user id vector is empty.

Definition at line 158 of file user.cc.

◆ User() [3/3]

user_chk::User::User ( UserId::UserIdType id_type,
const std::string & id_str )

Constructor.

Constructs a new User from a given id type and string containing the id data with an empty set of properties.

Parameters
id_typeType of id contained in the id vector
id_strstring of hex digits representing the user's id
Exceptions
isc::BadValueif user id string is empty or invalid

Definition at line 162 of file user.cc.

◆ ~User()

user_chk::User::~User ( )

Destructor.

Definition at line 166 of file user.cc.

Member Function Documentation

◆ delProperty()

void user_chk::User::delProperty ( const std::string & name)

Removes the given property from the property map.

Removes the given property from the map if found. If not, no harm no foul.

Parameters
nameproperty name to remove

Definition at line 202 of file user.cc.

◆ getProperties()

const PropertyMap & user_chk::User::getProperties ( ) const

Returns a reference to the map of properties.

Note that this reference can go out of scope and should not be relied upon other than for momentary use.

Definition at line 170 of file user.cc.

◆ getProperty()

std::string user_chk::User::getProperty ( const std::string & name) const

Fetches the string value for a given property name.

Parameters
nameproperty name to fetch
Returns
Returns the string value for the given name or an empty string if the property is not found in the property map.

Definition at line 189 of file user.cc.

◆ getUserId()

const UserId & user_chk::User::getUserId ( ) const

Returns the user's id.

Note that this reference can go out of scope and should not be relied upon other than for momentary use.

Definition at line 210 of file user.cc.

◆ setProperties()

void user_chk::User::setProperties ( const PropertyMap & properties)

Sets the user's properties from a given property map.

Replaces the contents of the user's property map with the given property map.

Parameters
propertiesproperty map to assign to the user

Definition at line 175 of file user.cc.

◆ setProperty()

void user_chk::User::setProperty ( const std::string & name,
const std::string & value )

Sets a given property to the given value.

Adds or updates the given property to the given value.

Parameters
namestring by which the property is identified (keyed)
valuestring data to associate with the property
Exceptions
isc::BadValueif name is blank.

Definition at line 179 of file user.cc.

References isc_throw.


The documentation for this class was generated from the following files: