lltemplatemessagereader.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLTEMPLATEMESSAGEREADER_H
00033 #define LL_LLTEMPLATEMESSAGEREADER_H
00034 
00035 #include "llmessagereader.h"
00036 
00037 #include <map>
00038 
00039 class LLMessageTemplate;
00040 class LLMsgData;
00041 
00042 class LLTemplateMessageReader : public LLMessageReader
00043 {
00044 public:
00045 
00046         typedef std::map<U32, LLMessageTemplate*> message_template_number_map_t;
00047 
00048         LLTemplateMessageReader(message_template_number_map_t&);
00049         virtual ~LLTemplateMessageReader();
00050 
00052         virtual void getBinaryData(const char *blockname, const char *varname, 
00053                                                            void *datap, S32 size, S32 blocknum = 0, 
00054                                                            S32 max_size = S32_MAX);
00055         virtual void getBOOL(const char *block, const char *var, BOOL &data, 
00056                                                  S32 blocknum = 0);
00057         virtual void getS8(const char *block, const char *var, S8 &data, 
00058                                            S32 blocknum = 0);
00059         virtual void getU8(const char *block, const char *var, U8 &data, 
00060                                            S32 blocknum = 0);
00061         virtual void getS16(const char *block, const char *var, S16 &data, 
00062                                                 S32 blocknum = 0);
00063         virtual void getU16(const char *block, const char *var, U16 &data, 
00064                                                 S32 blocknum = 0);
00065         virtual void getS32(const char *block, const char *var, S32 &data, 
00066                                                 S32 blocknum = 0);
00067         virtual void getF32(const char *block, const char *var, F32 &data, 
00068                                                 S32 blocknum = 0);
00069         virtual void getU32(const char *block, const char *var, U32 &data, 
00070                                                 S32 blocknum = 0);
00071         virtual void getU64(const char *block, const char *var, U64 &data, 
00072                                                 S32 blocknum = 0);
00073         virtual void getF64(const char *block, const char *var, F64 &data, 
00074                                                 S32 blocknum = 0);
00075         virtual void getVector3(const char *block, const char *var, 
00076                                                         LLVector3 &vec, S32 blocknum = 0);
00077         virtual void getVector4(const char *block, const char *var, 
00078                                                         LLVector4 &vec, S32 blocknum = 0);
00079         virtual void getVector3d(const char *block, const char *var, 
00080                                                          LLVector3d &vec, S32 blocknum = 0);
00081         virtual void getQuat(const char *block, const char *var, LLQuaternion &q, 
00082                                                  S32 blocknum = 0);
00083         virtual void getUUID(const char *block, const char *var, LLUUID &uuid, 
00084                                                  S32 blocknum = 0);
00085         virtual void getIPAddr(const char *block, const char *var, U32 &ip, 
00086                                                    S32 blocknum = 0);
00087         virtual void getIPPort(const char *block, const char *var, U16 &port, 
00088                                                    S32 blocknum = 0);
00089         virtual void getString(const char *block, const char *var, 
00090                                                    S32 buffer_size, char *buffer, S32 blocknum = 0);
00091 
00092         virtual S32     getNumberOfBlocks(const char *blockname);
00093         virtual S32     getSize(const char *blockname, const char *varname);
00094         virtual S32     getSize(const char *blockname, S32 blocknum, 
00095                                                 const char *varname);
00096 
00097         virtual void clearMessage();
00098 
00099         virtual const char* getMessageName() const;
00100         virtual S32 getMessageSize() const;
00101 
00102         virtual void copyToBuilder(LLMessageBuilder&) const;
00103 
00104         BOOL validateMessage(const U8* buffer, S32 buffer_size, 
00105                                                  const LLHost& sender);
00106         BOOL readMessage(const U8* buffer, const LLHost& sender);
00107 
00108         bool isTrusted() const;
00109         bool isBanned(bool trusted_source) const;
00110 
00111 private:
00112 
00113         void getData(const char *blockname, const char *varname, void *datap, 
00114                                  S32 size = 0, S32 blocknum = 0, S32 max_size = S32_MAX);
00115 
00116         BOOL decodeTemplate(const U8* buffer, S32 buffer_size,  // inputs
00117                                                 LLMessageTemplate** msg_template ); // outputs
00118 
00119         void logRanOffEndOfPacket( const LLHost& host, const S32 where, const S32 wanted );
00120 
00121         BOOL decodeData(const U8* buffer, const LLHost& sender );
00122 
00123         S32     mReceiveSize;
00124         LLMessageTemplate* mCurrentRMessageTemplate;
00125         LLMsgData* mCurrentRMessageData;
00126         message_template_number_map_t& mMessageNumbers;
00127 };
00128 
00129 #endif // LL_LLTEMPLATEMESSAGEREADER_H

Generated on Thu Jul 1 06:09:16 2010 for Second Life Viewer by  doxygen 1.4.7