Dibbler - a portable DHCPv6  1.0.2RC1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ClntMsg.h
Go to the documentation of this file.
1 /*
2  * Dibbler - a portable DHCPv6
3  *
4  * authors: Tomasz Mrugalski <thomson@klub.com.pl>
5  * Marek Senderski <msend@o2.pl>
6  * changes: Michal Kowalczuk <michal@kowalczuk.eu>
7  *
8  * released under GNU GPL v2 only licence
9  */
10 
11 #ifndef CLNTMSG_H
12 #define CLNTMSG_H
13 
14 #include "Msg.h"
15 #include "ClntIfaceMgr.h"
16 #include "ClntTransMgr.h"
17 #include "ClntCfgMgr.h"
18 #include "ClntAddrMgr.h"
19 #include "SmartPtr.h"
20 #include "Opt.h"
21 #include "OptStatusCode.h"
22 
23 class TClntMsg : public TMsg
24 {
25 public:
26  TClntMsg(int iface, SPtr<TIPv6Addr> addr, char* buf, int bufSize);
27 
28  TClntMsg(int iface, SPtr<TIPv6Addr> addr, int msgType);
29  ~TClntMsg();
30  unsigned long getTimeout();
31  void send();
32  SPtr<TOpt> parseExtraOption(const char *buf, unsigned int code, unsigned int length);
33 
34  //answer for a specific message
35  virtual void doDuties() = 0;
36  virtual bool check() = 0;
37  void setIface(int iface); // used to override when we have received msg via loopback interface.
38 
39  void copyAAASPI(SPtr<TClntMsg> q);
40 
42  void appendTAOptions(bool switchToInProcess);
43 
45  void appendElapsedOption();
48 
50 
51  // virtual std::string getName() = 0;
52  virtual void answer(SPtr<TClntMsg> reply);
53 
55  void deletePD(SPtr<TOpt> pd_);
56 
59 
60  protected:
61  bool check(bool clntIDmandatory, bool srvIDmandatory);
62  bool appendClientID();
63 
64  long IRT; // Initial Retransmission Time
65  long MRT; // Maximum Retransmission Time
66  long MRC; // Maximum Retransmission Count
67  long MRD; // Maximum Retransmission Duration
68  int RC; // Retransmission counter (counts to 0)
69  int RT; // Retransmission timeout (in seconds)
70  int FirstTimeStamp; // timestamp of the first transmission
71  int LastTimeStamp; // timestamp of the last transmission
72 
73  private:
74  void setDefaults();
75  void invalidAllowOptInMsg(int msg, int opt);
76  void invalidAllowOptInOpt(int msg, int parentOpt, int childOpt);
77 };
78 
79 #endif
80