00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef SNAC_BASE_H
00023 #define SNAC_BASE_H
00024
00025 class Buffer;
00026
00027 namespace ICQ2000 {
00028
00029
00030
00031
00032 const unsigned short SNAC_FAM_GEN = 0x0001;
00033 const unsigned short SNAC_FAM_LOC = 0x0002;
00034 const unsigned short SNAC_FAM_BUD = 0x0003;
00035 const unsigned short SNAC_FAM_MSG = 0x0004;
00036 const unsigned short SNAC_FAM_ADS = 0x0005;
00037 const unsigned short SNAC_FAM_INV = 0x0006;
00038 const unsigned short SNAC_FAM_ADM = 0x0007;
00039 const unsigned short SNAC_FAM_POP = 0x0008;
00040 const unsigned short SNAC_FAM_BOS = 0x0009;
00041 const unsigned short SNAC_FAM_LUP = 0x000a;
00042 const unsigned short SNAC_FAM_STS = 0x000b;
00043 const unsigned short SNAC_FAM_TRT = 0x000c;
00044 const unsigned short SNAC_FAM_CNV = 0x000d;
00045 const unsigned short SNAC_FAM_CHT = 0x000e;
00046
00047 const unsigned short SNAC_FAM_SBL = 0x0013;
00048
00049 const unsigned short SNAC_FAM_SRV = 0x0015;
00050 const unsigned short SNAC_FAM_UIN = 0x0017;
00051
00052
00053
00054 class SNAC {
00055 protected:
00056 unsigned short m_flags;
00057 unsigned int m_requestID;
00058
00059 public:
00060 SNAC();
00061 virtual ~SNAC() { }
00062
00063 virtual unsigned short Family() const = 0;
00064 virtual unsigned short Subtype() const = 0;
00065
00066 virtual unsigned short Flags() const;
00067 virtual unsigned int RequestID() const;
00068 void setRequestID(unsigned int id);
00069 void setFlags(unsigned short fl);
00070 };
00071
00072
00073 class InSNAC : virtual public SNAC {
00074 protected:
00075 virtual void ParseBody(Buffer& b) = 0;
00076
00077 public:
00078 virtual void Parse(Buffer& b);
00079 };
00080
00081
00082 class OutSNAC : virtual public SNAC {
00083 protected:
00084 virtual void OutputHeader(Buffer& b) const;
00085 virtual void OutputBody(Buffer& b) const = 0;
00086
00087 public:
00088 virtual void Output(Buffer& b) const;
00089 };
00090
00091
00092
00093 class RawSNAC : public InSNAC {
00094 protected:
00095 unsigned short m_family, m_subtype;
00096
00097 void ParseBody(Buffer& b);
00098
00099 public:
00100 RawSNAC(unsigned short f, unsigned short t);
00101
00102 unsigned short Family() const { return m_family; }
00103 unsigned short Subtype() const { return m_subtype; }
00104 };
00105
00106 }
00107
00108 Buffer& operator<<(Buffer& b, const ICQ2000::OutSNAC& t);
00109
00110 #endif