1: 
   2: 
   3: /*************
   4: *            *
   5: *  SENTINEL  *
   6: *            *
   7: *************/
   8: 
   9: 
  10: #ifndef WWWI_MIND_DNSPACKET_H 
  11: #define WWWI_MIND_DNSPACKET_H 
  12: 
  13: 
  14: /*********************
  15: *                    *
  16: *  PROJECT INCLUDES  *
  17: *                    *
  18: *********************/
  19: 
  20: 
  21: #include "mind.h" 
  22: #include "buffer.h" 
  23: #include "request.h" 
  24: #include "rrlist.h" 
  25: #include "response.h" 
  26: 
  27: 
  28: using WWWI::SockAddrIn;
  29: 
  30: 
  31: /**********************
  32: *                     *
  33: *  TYPE DECLARATIONS  *
  34: *                     *
  35: **********************/
  36: 
  37: 
  38: /********************
  39: *                   *
  40: *  CLASS DNSPACKET  *
  41: *                   *
  42: ********************/
  43: 
  44: 
  45: class DNSPacket : public Buffer {
  46: public:
  47:                      DNSPacket(void);
  48:                      DNSPacket(SockAddrIn* &i_siprRemote, unsigned short i_usID, QuestionConstPtr ci_qnp);
  49:                      DNSPacket(SockAddrIn* &i_siprRemote, unsigned short i_usID, RequestConstPtr ci_rqp, ResponseConstPtr i_rsp = NULL);
  50:   void               Format(unsigned short i_usID, RequestConstPtr ci_rqp, ResponseConstPtr ci_rsp = NULL);
  51:   void               Parse(unsigned short &io_usrID, RequestPtr &o_rqpr, ResponsePtr &o_rspr) const;
  52:   void               ReadQuestion(QuestionPtr &o_qnpr) const;
  53:   void               ReadRR(RRPtr &o_rrpr) const;
  54:   void               ReadRRList(RRListPtr &o_rlpr, unsigned short i_usCount) const;
  55:   inline SockAddrIn *RemoveAddr(void);
  56:   inline bool        TestID(unsigned short i_usID) const;
  57:   void               WriteQuestion(QuestionConstPtr ci_qnp);
  58:   void               WriteRR(RRConstPtr ci_rrp);
  59:   unsigned short     WriteRRList(RRListConstPtr ci_rlp);
  60:                     ~DNSPacket(void);
  61:  
  62: protected:
  63:   SockAddrIn          *m_sipRemote;
  64:   static const size_t  scm_szPacketMax = 512;
  65:   off_t                m_ofRollBack;
  66: 
  67:   friend class DNSSocket;
  68: };
  69: DECL_POINTER_TYPES(DNSPacket)
  70: 
  71: 
  72: ostream& operator<<(ostream& io_smr, const DNSPacket &ci_dpr);
  73: ostream& operator<<(ostream& io_smr, DNSPacketConstPtr ci_dpp);
  74: 
  75: 
  76: /*********************
  77: *                    *
  78: *  INLINE FUNCTIONS  *
  79: *                    *
  80: *********************/
  81: 
  82: 
  83: #include "dnspacket.i" 
  84: 
  85: 
  86: /************
  87: *           *
  88: *  THE END  *
  89: *           *
  90: ************/
  91: 
  92: 
  93: #endif 
  94: 
  95: 
  96: