diff options
Diffstat (limited to 'linden/indra/llmessage/message.cpp')
-rw-r--r-- | linden/indra/llmessage/message.cpp | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/linden/indra/llmessage/message.cpp b/linden/indra/llmessage/message.cpp index b20731a..3ee3c03 100644 --- a/linden/indra/llmessage/message.cpp +++ b/linden/indra/llmessage/message.cpp | |||
@@ -3956,22 +3956,27 @@ void LLMessageSystem::getString(const char *block, const char *var, | |||
3956 | blocknum); | 3956 | blocknum); |
3957 | } | 3957 | } |
3958 | 3958 | ||
3959 | S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) | 3959 | BOOL LLMessageSystem::has(const char *blockname) const |
3960 | { | ||
3961 | return getNumberOfBlocks(blockname) > 0; | ||
3962 | } | ||
3963 | |||
3964 | S32 LLMessageSystem::getNumberOfBlocksFast(const char *blockname) const | ||
3960 | { | 3965 | { |
3961 | return mMessageReader->getNumberOfBlocks(blockname); | 3966 | return mMessageReader->getNumberOfBlocks(blockname); |
3962 | } | 3967 | } |
3963 | 3968 | ||
3964 | S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) | 3969 | S32 LLMessageSystem::getNumberOfBlocks(const char *blockname) const |
3965 | { | 3970 | { |
3966 | return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname)); | 3971 | return getNumberOfBlocksFast(LLMessageStringTable::getInstance()->getString(blockname)); |
3967 | } | 3972 | } |
3968 | 3973 | ||
3969 | S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) | 3974 | S32 LLMessageSystem::getSizeFast(const char *blockname, const char *varname) const |
3970 | { | 3975 | { |
3971 | return mMessageReader->getSize(blockname, varname); | 3976 | return mMessageReader->getSize(blockname, varname); |
3972 | } | 3977 | } |
3973 | 3978 | ||
3974 | S32 LLMessageSystem::getSize(const char *blockname, const char *varname) | 3979 | S32 LLMessageSystem::getSize(const char *blockname, const char *varname) const |
3975 | { | 3980 | { |
3976 | return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), | 3981 | return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), |
3977 | LLMessageStringTable::getInstance()->getString(varname)); | 3982 | LLMessageStringTable::getInstance()->getString(varname)); |
@@ -3979,13 +3984,13 @@ S32 LLMessageSystem::getSize(const char *blockname, const char *varname) | |||
3979 | 3984 | ||
3980 | // size in bytes of variable length data | 3985 | // size in bytes of variable length data |
3981 | S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum, | 3986 | S32 LLMessageSystem::getSizeFast(const char *blockname, S32 blocknum, |
3982 | const char *varname) | 3987 | const char *varname) const |
3983 | { | 3988 | { |
3984 | return mMessageReader->getSize(blockname, blocknum, varname); | 3989 | return mMessageReader->getSize(blockname, blocknum, varname); |
3985 | } | 3990 | } |
3986 | 3991 | ||
3987 | S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum, | 3992 | S32 LLMessageSystem::getSize(const char *blockname, S32 blocknum, |
3988 | const char *varname) | 3993 | const char *varname) const |
3989 | { | 3994 | { |
3990 | return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum, | 3995 | return getSizeFast(LLMessageStringTable::getInstance()->getString(blockname), blocknum, |
3991 | LLMessageStringTable::getInstance()->getString(varname)); | 3996 | LLMessageStringTable::getInstance()->getString(varname)); |
@@ -4021,3 +4026,18 @@ bool LLMessageSystem::checkAllMessages(S64 frame_count, LLPumpIO* http_pump) | |||
4021 | http_pump->callback(); | 4026 | http_pump->callback(); |
4022 | return (mPacketsIn - packetsIn) > 0; | 4027 | return (mPacketsIn - packetsIn) > 0; |
4023 | } | 4028 | } |
4029 | |||
4030 | void LLMessageSystem::banUdpMessage(const std::string& name) | ||
4031 | { | ||
4032 | message_template_name_map_t::iterator itt = mMessageTemplates.find( | ||
4033 | LLMessageStringTable::getInstance()->getString(name.c_str()) | ||
4034 | ); | ||
4035 | if(itt != mMessageTemplates.end()) | ||
4036 | { | ||
4037 | itt->second->banUdp(); | ||
4038 | } | ||
4039 | else | ||
4040 | { | ||
4041 | llwarns << "Attempted to ban an unknown message: " << name << "." << llendl; | ||
4042 | } | ||
4043 | } | ||