Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TSrvMsg Class Reference

#include <SrvMsg.h>

+ Inheritance diagram for TSrvMsg:
+ Collaboration diagram for TSrvMsg:

Classes

struct  RelayInfo

Public Member Functions

 TSrvMsg (int iface, SPtr< TIPv6Addr > addr, char *buf, int bufSize)
 TSrvMsg (int iface, SPtr< TIPv6Addr > addr, int msgType, long transID)
void addRelayInfo (SPtr< TIPv6Addr > linkAddr, SPtr< TIPv6Addr > peerAddr, int hop, const TOptList &echoList)
void appendAuthenticationOption (SPtr< TDUID > duid)
bool appendMandatoryOptions (SPtr< TOptOptionRequest > oro, bool includeClientID=true)
void appendReconfigureKey ()
bool appendRequestedOptions (SPtr< TDUID > duid, SPtr< TIPv6Addr > addr, int iface, SPtr< TOptOptionRequest > reqOpt)
void appendStatusCode ()
bool appendVendorSpec (SPtr< TDUID > duid, int iface, int vendor, SPtr< TOptOptionRequest > reqOpt)
virtual bool check ()=0
void clearRelayInfo ()
 clears relay information (used in testing only)
void copyAAASPI (SPtr< TSrvMsg > q)
bool copyClientID (SPtr< TMsg > donor)
void copyRelayInfo (SPtr< TSrvMsg > q)
void copyRemoteID (SPtr< TSrvMsg > q)
void doDuties ()
SPtr< TDUIDgetClientDUID ()
SPtr< TIPv6AddrgetClientPeer ()
int getPhysicalIface () const
 returns physical interface index
SPtr< TOptVendorDatagetRemoteID ()
unsigned long getTimeout ()
void processOptions (SPtr< TSrvMsg > clientMsg, bool quiet)
bool releaseAll (bool quiet)
 Releases all addresses and prefixes specified in this message.
void send (int dstPort=0)
void setMsgType (uint8_t type)
 sets message type (used in testing only)
void setPhysicalIface (int iface)
 sets physical interface index
void setRemoteID (SPtr< TOptVendorData > remoteID)
std::string showRequestedOptions (SPtr< TOptOptionRequest > oro)
bool validateReplayDetection ()
- Public Member Functions inherited from TMsg
 TMsg (int iface, SPtr< TIPv6Addr > addr, int msgType)
 TMsg (int iface, SPtr< TIPv6Addr > addr, int msgType, long transID)
 TMsg (int iface, SPtr< TIPv6Addr > addr, char *&buf, int &bufSize)
virtual ~TMsg ()
void addOption (SPtr< TOpt > opt)
void calculateDigests (char *buffer, size_t len)
int countOption ()
void firstOption ()
TKey getAuthKey ()
SPtr< TOptDUIDgetClientID () const
 returns client-id option (if present)
int getIface ()
SPtr< TIPv6AddrgetLocalAddr ()
virtual std::string getName () const =0
void * getNotifyScriptParams ()
SPtr< TOptgetOption (int type) const
virtual SPtr< TOptgetOption ()
TOptListgetOptLst ()
SPtr< TOptOptionRequestgetORO () const
 returns ORO (if present)
SPtr< TIPv6AddrgetRemoteAddr ()
SPtr< TOptDUIDgetServerID () const
 returns server-id option (if present)
virtual int getSize ()
uint32_t getSPI ()
long getTransID ()
long getType ()
bool isDone ()
bool isDone (bool done)
bool loadAuthKey ()
void setAuthDigestPtr (char *ptr, unsigned len)
void setAuthKey (const TKey &key)
void setLocalAddr (SPtr< TIPv6Addr > myaddr)
void setSPI (uint32_t val)
virtual int storeSelf (char *buffer)
bool validateAuthInfo (char *buf, int bufSize, AuthProtocols proto, const DigestTypesLst &acceptedDigestTypes)

Public Attributes

std::vector< RelayInfoRelayInfo_
 Relay information.
- Public Attributes inherited from TMsg
DigestTypes DigestType_

Protected Member Functions

SPtr< TSrvOptFQDNaddFQDN (int iface, SPtr< TSrvOptFQDN > requestFQDN, SPtr< TDUID > clntDuid, SPtr< TIPv6Addr > clntAddr, std::string hint, bool doRealUpdate)
bool check (bool clntIDmandatory, bool srvIDmandatory)
void delFQDN (SPtr< TSrvCfgIface > cfgIface, SPtr< TAddrIA > ptrIA, SPtr< TFQDN > fqdn)
void getORO (SPtr< TMsg > clientMessage)
void handleDefaultOption (SPtr< TOpt > ptrOpt)
void processFQDN (SPtr< TSrvMsg > clientMsg, SPtr< TSrvOptFQDN > q)
void processIA_NA (SPtr< TSrvMsg > clientMsg, SPtr< TSrvOptIA_NA > q)
void processIA_PD (SPtr< TSrvMsg > clientMsg, SPtr< TSrvOptIA_PD > q)
void processIA_TA (SPtr< TSrvMsg > clientMsg, SPtr< TSrvOptTA > q)
void setDefaults ()
int storeSelfRelay (char *buf, uint8_t relayLevel, ESrvIfaceIdOrder order)
- Protected Member Functions inherited from TMsg
bool delOption (int code)
void setAttribs (int iface, SPtr< TIPv6Addr > addr, int msgType, long transID)

Protected Attributes

SPtr< TDUIDClientDUID
unsigned long FirstTimeStamp_
uint8_t forceMsgType_
 used in tests only. If non-zero, send message type is set to that type
unsigned long MRT_
SPtr< TOptOptionRequestORO
int physicalIface_
 physical interface from/to which message was received/should be sent
SPtr< TOptVendorDataRemoteID
- Protected Attributes inherited from TMsg
unsigned AuthDigestLen_
char * AuthDigestPtr_
TKey AuthKey_
int Iface
bool IsDone
SPtr< TIPv6AddrLocalAddr_
 Address the packet was received on.
int MsgType
TOptList::iterator NextOpt
TNotifyScriptParamsNotifyScripts
TOptList Options
SPtr< TIPv6AddrPeerAddr_
uint32_t SPI_
long TransID

Constructor & Destructor Documentation

TSrvMsg::TSrvMsg ( int  iface,
SPtr< TIPv6Addr addr,
char *  buf,
int  bufSize 
)

this constructor builds message based on the buffer (i.e. SOLICIT, REQUEST, RENEW, REBIND, RELEASE, INF-REQUEST, DECLINE)

Parameters
iface
addr
buf
bufSize
TSrvMsg::TSrvMsg ( int  iface,
SPtr< TIPv6Addr addr,
int  msgType,
long  transID 
)

this constructor is used to build message as a reply to the received message (i.e. it is used to contruct ADVERTISE or REPLY)

Parameters
iface
addr
msgType
transID

Member Function Documentation

SPtr< TSrvOptFQDN > TSrvMsg::addFQDN ( int  iface,
SPtr< TSrvOptFQDN requestFQDN,
SPtr< TDUID clntDuid,
SPtr< TIPv6Addr clntAddr,
std::string  hint,
bool  doRealUpdate 
)
protected

creates FQDN option and executes DNS Update procedure (if necessary)

Parameters
ifaceinterface index
requestFQDNrequested Fully Qualified Domain Name
clntDuidclient DUID
clntAddrclient address
hinthint used to get name (it may or may not be used)
doRealUpdate- should the real update be performed (for example if response for SOLICIT is prepare, this should be set to false)
Returns
FQDN option
void TSrvMsg::addRelayInfo ( SPtr< TIPv6Addr linkAddr,
SPtr< TIPv6Addr peerAddr,
int  hop,
const TOptList echoList 
)
Todo:
: modify this to use RelayInfo structure
Todo:
: what about this?
void TSrvMsg::appendAuthenticationOption ( SPtr< TDUID duid)

this function appends authentication option

Todo:
: server now forces its default algorithm. It should be possible for the server to keep using whatever the client chose.
bool TSrvMsg::appendMandatoryOptions ( SPtr< TOptOptionRequest oro,
bool  includeClientID = true 
)
void TSrvMsg::appendReconfigureKey ( )
bool TSrvMsg::appendRequestedOptions ( SPtr< TDUID duid,
SPtr< TIPv6Addr addr,
int  iface,
SPtr< TOptOptionRequest reqOpts 
)

this function appends all standard options

Parameters
duid
addr
iface
reqOpts
Returns
true, if any options (conveying configuration paramter) has been appended
Todo:
: Make this an array of options and handle them in an uniform manner
void TSrvMsg::appendStatusCode ( )

copy status-code to top-level if something is wrong (i.e. status-code!=SUCCESS)

bool TSrvMsg::appendVendorSpec ( SPtr< TDUID duid,
int  iface,
int  vendor,
SPtr< TOptOptionRequest reqOpt 
)
bool TSrvMsg::check ( bool  clntIDmandatory,
bool  srvIDmandatory 
)
protectedvirtual

checks if appropriate number of server/client IDs has been attached

Parameters
srvIDmandatory- is ServerID option mandatory? (false==ServerID not allowed)
clntIDmandatory- is ClientID option mandatory?(false==ClientID is optional)
Returns

Reimplemented from TMsg.

void TSrvMsg::clearRelayInfo ( )
inline

clears relay information (used in testing only)

void TSrvMsg::copyAAASPI ( SPtr< TSrvMsg q)
bool TSrvMsg::copyClientID ( SPtr< TMsg donor)
void TSrvMsg::copyRelayInfo ( SPtr< TSrvMsg q)
void TSrvMsg::copyRemoteID ( SPtr< TSrvMsg q)
void TSrvMsg::delFQDN ( SPtr< TSrvCfgIface cfgIface,
SPtr< TAddrIA ptrIA,
SPtr< TFQDN fqdn 
)
protected
SPtr< TDUID > TSrvMsg::getClientDUID ( )
SPtr< TIPv6Addr > TSrvMsg::getClientPeer ( )
void TSrvMsg::getORO ( SPtr< TMsg msg)
protected

finds OPTION_REQUEST OPTION in options

Parameters
msg- parent message
int TSrvMsg::getPhysicalIface ( ) const

returns physical interface index

This may be different than Iface_ for relayed messages

SPtr< TOptVendorData > TSrvMsg::getRemoteID ( )
void TSrvMsg::handleDefaultOption ( SPtr< TOpt ptrOpt)
protected
void TSrvMsg::processFQDN ( SPtr< TSrvMsg clientMsg,
SPtr< TSrvOptFQDN q 
)
protected
void TSrvMsg::processIA_NA ( SPtr< TSrvMsg clientMsg,
SPtr< TSrvOptIA_NA q 
)
protected
void TSrvMsg::processIA_PD ( SPtr< TSrvMsg clientMsg,
SPtr< TSrvOptIA_PD q 
)
protected
void TSrvMsg::processIA_TA ( SPtr< TSrvMsg clientMsg,
SPtr< TSrvOptTA q 
)
protected
void TSrvMsg::processOptions ( SPtr< TSrvMsg clientMsg,
bool  quiet 
)

Processes options in incoming message and assigns leases and options, if possible. This method may be used in any message that causes server to assign anything, i.e. SOLICIT, REQUEST, RENEW, REBIND (and possibly CONFIRM)

Parameters
clientMsgclient message
quiet(false will make this method verbose)
Todo:
: remember that client supports reconfigure
bool TSrvMsg::releaseAll ( bool  quiet)

Releases all addresses and prefixes specified in this message.

Parameters
quietbe quiet (false = verbose)
Returns
true, if anything was released
void TSrvMsg::send ( int  dstPort = 0)
void TSrvMsg::setDefaults ( )
protected
void TSrvMsg::setMsgType ( uint8_t  type)
inline

sets message type (used in testing only)

Parameters
typetype of a message (RELAY_FORW or RELAY_REPL)
void TSrvMsg::setPhysicalIface ( int  iface)

sets physical interface index

This may be different than Iface_ for relayed messages

void TSrvMsg::setRemoteID ( SPtr< TOptVendorData remoteID)
Todo:
: get out with this shit
string TSrvMsg::showRequestedOptions ( SPtr< TOptOptionRequest oro)

this function prints all options specified in the ORO option

int TSrvMsg::storeSelfRelay ( char *  buf,
uint8_t  relayDepth,
ESrvIfaceIdOrder  order 
)
protected

stores message in a buffer, used in relayed messages

Parameters
bufbuffer for data to be stored
relayDepthnumber or current relay level
orderorder of the interface-id option (before, after or omit)
Returns
- number of bytes used
bool TSrvMsg::validateReplayDetection ( )

verifies if the received packet is a replayed message

Returns
true if message is ok (false if it is replayed and should be dropped)

Member Data Documentation

SPtr<TDUID> TSrvMsg::ClientDUID
protected
unsigned long TSrvMsg::FirstTimeStamp_
protected
uint8_t TSrvMsg::forceMsgType_
protected

used in tests only. If non-zero, send message type is set to that type

unsigned long TSrvMsg::MRT_
protected
SPtr<TOptOptionRequest> TSrvMsg::ORO
protected
int TSrvMsg::physicalIface_
protected

physical interface from/to which message was received/should be sent

std::vector<RelayInfo> TSrvMsg::RelayInfo_

Relay information.

Let's make this public, so there are issues with reference being returned and then used past them message lifetime

SPtr<TOptVendorData> TSrvMsg::RemoteID
protected
Todo:
: this should be moved to RelayInfo_ structure

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