Main Page   Class Hierarchy   Compound List   File List   Compound Members   Related Pages  

SNAC-GEN.h

00001 /*
00002  * SNAC - General
00003  *
00004  * Copyright (C) 2001 Barnaby Gray <barnaby@beedesign.co.uk>
00005  *
00006  * This library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public
00008  * License as published by the Free Software Foundation; either
00009  * version 2.1 of the License, or (at your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00019  *
00020  */
00021 
00022 #ifndef SNAC_GEN_H
00023 #define SNAC_GEN_H
00024 
00025 #include <string>
00026 
00027 #include <libicq2000/SNAC-base.h>
00028 #include <libicq2000/UserInfoBlock.h>
00029 
00030 namespace ICQ2000 {
00031 
00032   // Generic (Family 0x0001)
00033   const unsigned short SNAC_GEN_Error = 0x0001;
00034   const unsigned short SNAC_GEN_ClientReady = 0x0002;
00035   const unsigned short SNAC_GEN_ServerReady = 0x0003;
00036   const unsigned short SNAC_GEN_NewService = 0x0004;
00037   const unsigned short SNAC_GEN_Redirect = 0x0005;
00038   const unsigned short SNAC_GEN_RequestRateInfo = 0x0006;
00039   const unsigned short SNAC_GEN_RateInfo = 0x0007;
00040   const unsigned short SNAC_GEN_RateInfoAck = 0x0008;
00041   const unsigned short SNAC_GEN_RateInfoChange = 0x000a;
00042   const unsigned short SNAC_GEN_ServerPause = 0x000b;
00043   const unsigned short SNAC_GEN_ServerResume = 0x000d;
00044 
00045   const unsigned short SNAC_GEN_UserInfoRequest = 0x000e;
00046   const unsigned short SNAC_GEN_UserInfo = 0x000f;
00047   const unsigned short SNAC_GEN_Evil = 0x0010; // ??
00048   const unsigned short SNAC_GEN_SetIdle = 0x0011; // maybe AIM specific?
00049   const unsigned short SNAC_GEN_MigrationRequest = 0x0012; // maybe AIM specific?
00050   const unsigned short SNAC_GEN_MOTD = 0x0013;
00051   const unsigned short SNAC_GEN_SetPrivFlags = 0x0014;
00052   const unsigned short SNAC_GEN_WellKnownURL = 0x0015; // ??
00053   const unsigned short SNAC_GEN_NOP = 0x0016;
00054 
00055   // The next lot seem to be ICQ specific
00056   const unsigned short SNAC_GEN_Capabilities = 0x0017;
00057   const unsigned short SNAC_GEN_CapAck = 0x0018;
00058   const unsigned short SNAC_GEN_SetStatus = 0x001e;
00059 
00060   // ------------ Generic (Family 0x0001) SNACs -------------
00061   
00062   class GenericSNAC : virtual public SNAC {
00063    public:
00064     unsigned short Family() const { return SNAC_FAM_GEN; }
00065   };
00066 
00067   class ServerReadySNAC : public GenericSNAC, public InSNAC {
00068    protected:
00069     void ParseBody(Buffer& b);
00070     
00071    public:
00072     ServerReadySNAC() { }
00073 
00074     unsigned short Subtype() const { return SNAC_GEN_ServerReady; }
00075   };
00076 
00077   class RequestRateInfoSNAC : public GenericSNAC, public OutSNAC {
00078    protected:
00079     void OutputBody(Buffer& b) const;
00080 
00081    public:
00082     RequestRateInfoSNAC() { }
00083     unsigned short Subtype() const { return SNAC_GEN_RequestRateInfo; }
00084   };
00085 
00086   class RateInfoSNAC : public GenericSNAC, public InSNAC {
00087    protected:
00088     void ParseBody(Buffer& b);
00089 
00090    public:
00091     RateInfoSNAC() { }
00092     unsigned short Subtype() const { return SNAC_GEN_RateInfo; }
00093   };
00094 
00095   class RateInfoAckSNAC : public GenericSNAC, public OutSNAC {
00096    protected:
00097     void OutputBody(Buffer& b) const;
00098 
00099    public:
00100     RateInfoAckSNAC() { }
00101     unsigned short Subtype() const { return SNAC_GEN_RateInfoAck; }
00102   };
00103 
00104   class CapabilitiesSNAC : public GenericSNAC, public OutSNAC {
00105    protected:
00106     void OutputBody(Buffer& b) const;
00107 
00108    public:
00109     CapabilitiesSNAC() { }
00110     unsigned short Subtype() const { return SNAC_GEN_Capabilities; }
00111   };
00112 
00113   class CapAckSNAC : public GenericSNAC, public InSNAC {
00114    protected:
00115     void ParseBody(Buffer& b);
00116     
00117    public:
00118     CapAckSNAC() { }
00119 
00120     unsigned short Subtype() const { return SNAC_GEN_CapAck; }
00121   };
00122 
00123   class SetStatusSNAC : public GenericSNAC, public OutSNAC {
00124    private:
00125     unsigned short m_status, m_port;
00126     unsigned int m_ip;
00127     bool m_sendextra;
00128 
00129    protected:
00130     void OutputBody(Buffer& b) const;
00131 
00132    public:
00133     SetStatusSNAC(unsigned short status);
00134     unsigned short Subtype() const { return SNAC_GEN_SetStatus; }
00135 
00136     void setSendExtra(bool b);
00137     void setIP(unsigned int ip);
00138     void setPort(unsigned short port);
00139   };
00140 
00141   class SetIdleSNAC : public GenericSNAC, public OutSNAC {
00142    protected:
00143     void OutputBody(Buffer& b) const;
00144 
00145    public:
00146     SetIdleSNAC() { }
00147     unsigned short Subtype() const { return SNAC_GEN_SetIdle; }
00148   };
00149 
00150   class ClientReadySNAC : public GenericSNAC, public OutSNAC {
00151    protected:
00152     void OutputBody(Buffer& b) const;
00153 
00154    public:
00155     ClientReadySNAC() { }
00156     unsigned short Subtype() const { return SNAC_GEN_ClientReady; }
00157   };
00158 
00159   class PersonalInfoRequestSNAC : public GenericSNAC, public OutSNAC {
00160    protected:
00161     void OutputBody(Buffer& b) const;
00162 
00163    public:
00164     PersonalInfoRequestSNAC() { }
00165     unsigned short Subtype() const { return SNAC_GEN_UserInfoRequest; }
00166   };
00167 
00168   class UserInfoSNAC : public GenericSNAC, public InSNAC {
00169    private:
00170     UserInfoBlock m_userinfo;
00171 
00172    protected:
00173     void ParseBody(Buffer& b);
00174     
00175    public:
00176     UserInfoSNAC() { }
00177 
00178     unsigned short Subtype() const { return SNAC_GEN_UserInfo; }
00179     const UserInfoBlock& getUserInfo() const { return m_userinfo; }
00180   };
00181 
00182   const unsigned char MOTD_MANDATORY_UPGRADE = 0x01; // hehe - like we're going to obey this :-)
00183   const unsigned char MOTD_ADVISORY_UPGRADE = 0x02;
00184   const unsigned char MOTD_SYSTEM_BULLETIN = 0x03;
00185   const unsigned char MOTD_NORMAL = 0x04;
00186 
00187   class MOTDSNAC : public GenericSNAC, public InSNAC {
00188    private:
00189     unsigned char m_status;
00190     string m_url;
00191 
00192    protected:
00193     void ParseBody(Buffer& b);
00194     
00195    public:
00196     MOTDSNAC() { }
00197 
00198     unsigned short Subtype() const { return SNAC_GEN_MOTD; }
00199   };
00200   
00201   class RateInfoChangeSNAC : public GenericSNAC, public InSNAC {
00202    private:
00203     unsigned short m_code;      
00204     unsigned short m_rateclass; 
00205     unsigned int m_windowsize;
00206     unsigned int m_clear;
00207     unsigned int m_alert;
00208     unsigned int m_limit;
00209     unsigned int m_disconnect;
00210     unsigned int m_currentavg;
00211     unsigned int m_maxavg;
00212     
00213    protected:
00214     void ParseBody(Buffer& b);
00215     
00216    public:
00217     RateInfoChangeSNAC() { }
00218     unsigned short getCode() const { return m_code; }   
00219     unsigned short getRateClass() const { return m_rateclass; } 
00220     unsigned int getWindowSize() const { return m_windowsize; }
00221     unsigned int getClear() const { return m_clear; }
00222     unsigned int getAlert() const { return m_alert; }
00223     unsigned int getLimit() const { return m_limit; }
00224     unsigned int getDisconnect() const { return m_disconnect; }
00225     unsigned int getCurrentAvg() const { return m_currentavg; }
00226     unsigned int getMaxAvg() const { return m_maxavg; }
00227     
00228     unsigned short Subtype() const { return SNAC_GEN_RateInfoChange; }
00229   };
00230    
00231 }
00232 
00233 #endif

Generated on Tue Jan 15 12:24:35 2002 for libicq2000 by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001