aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llmessage/message.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:02 -0500
committerJacek Antonelli2008-08-15 23:45:02 -0500
commitd644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd (patch)
tree7ed0c2c27d717801238a2e6b5749cd5bf88c3059 /linden/indra/llmessage/message.h
parentSecond Life viewer sources 1.17.3.0 (diff)
downloadmeta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.zip
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.gz
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.bz2
meta-impy-d644fc64407dcd14ffcee6a0e9fbe28ee3a4e9bd.tar.xz
Second Life viewer sources 1.18.0.6
Diffstat (limited to '')
-rw-r--r--linden/indra/llmessage/message.h76
1 files changed, 57 insertions, 19 deletions
diff --git a/linden/indra/llmessage/message.h b/linden/indra/llmessage/message.h
index 0a55485..6c834f7 100644
--- a/linden/indra/llmessage/message.h
+++ b/linden/indra/llmessage/message.h
@@ -1,5 +1,5 @@
1/** 1/**
2 * @FILE message.h 2 * @file message.h
3 * @brief LLMessageSystem class header file 3 * @brief LLMessageSystem class header file
4 * 4 *
5 * Copyright (c) 2001-2007, Linden Research, Inc. 5 * Copyright (c) 2001-2007, Linden Research, Inc.
@@ -50,11 +50,13 @@
50#include "lltimer.h" 50#include "lltimer.h"
51#include "llpacketring.h" 51#include "llpacketring.h"
52#include "llhost.h" 52#include "llhost.h"
53#include "llhttpclient.h"
53#include "llhttpnode.h" 54#include "llhttpnode.h"
54#include "llpacketack.h" 55#include "llpacketack.h"
55#include "message_prehash.h" 56#include "message_prehash.h"
56#include "llstl.h" 57#include "llstl.h"
57#include "llmsgvariabletype.h" 58#include "llmsgvariabletype.h"
59#include "llmsgvariabletype.h"
58 60
59const U32 MESSAGE_MAX_STRINGS_LENGTH = 64; 61const U32 MESSAGE_MAX_STRINGS_LENGTH = 64;
60const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192; 62const U32 MESSAGE_NUMBER_OF_HASH_BUCKETS = 8192;
@@ -126,7 +128,16 @@ const U8 LL_RELIABLE_FLAG = 0x40;
126const U8 LL_RESENT_FLAG = 0x20; 128const U8 LL_RESENT_FLAG = 0x20;
127const U8 LL_ACK_FLAG = 0x10; 129const U8 LL_ACK_FLAG = 0x10;
128 130
129const S32 LL_MINIMUM_VALID_PACKET_SIZE = LL_PACKET_ID_SIZE + 1; // 4 bytes id + 1 byte message name (high) 131// 1 byte flags, 4 bytes sequence, 1 byte offset + 1 byte message name (high)
132const S32 LL_MINIMUM_VALID_PACKET_SIZE = LL_PACKET_ID_SIZE + 1;
133enum EPacketHeaderLayout
134{
135 PHL_FLAGS = 0,
136 PHL_PACKET_ID = 1,
137 PHL_OFFSET = 5,
138 PHL_NAME = 6
139};
140
130 141
131const S32 LL_DEFAULT_RELIABLE_RETRIES = 3; 142const S32 LL_DEFAULT_RELIABLE_RETRIES = 3;
132const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f; 143const F32 LL_MINIMUM_RELIABLE_TIMEOUT_SECONDS = 1.f;
@@ -155,8 +166,6 @@ class LLUUID;
155class LLMessageSystem; 166class LLMessageSystem;
156class LLPumpIO; 167class LLPumpIO;
157 168
158// message data pieces are used to collect the data called for by the message template
159
160// message system exceptional condition handlers. 169// message system exceptional condition handlers.
161enum EMessageException 170enum EMessageException
162{ 171{
@@ -168,6 +177,7 @@ enum EMessageException
168typedef void (*msg_exception_callback)(LLMessageSystem*,void*,EMessageException); 177typedef void (*msg_exception_callback)(LLMessageSystem*,void*,EMessageException);
169 178
170 179
180// message data pieces are used to collect the data called for by the message template
171class LLMsgData; 181class LLMsgData;
172class LLMsgBlkData; 182class LLMsgBlkData;
173class LLMessageTemplate; 183class LLMessageTemplate;
@@ -180,6 +190,8 @@ class LLMessageReader;
180class LLTemplateMessageReader; 190class LLTemplateMessageReader;
181class LLSDMessageReader; 191class LLSDMessageReader;
182 192
193
194
183class LLUseCircuitCodeResponder 195class LLUseCircuitCodeResponder
184{ 196{
185 LOG_CLASS(LLMessageSystem); 197 LOG_CLASS(LLMessageSystem);
@@ -204,7 +216,6 @@ class LLMessageSystem
204 // Set this flag to TRUE when you want *very* verbose logs. 216 // Set this flag to TRUE when you want *very* verbose logs.
205 BOOL mVerboseLog; 217 BOOL mVerboseLog;
206 218
207 U32 mMessageFileChecksum;
208 F32 mMessageFileVersionNumber; 219 F32 mMessageFileVersionNumber;
209 220
210 typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t; 221 typedef std::map<const char *, LLMessageTemplate*> message_template_name_map_t;
@@ -450,8 +461,11 @@ public:
450 void forwardReliable(const LLHost &host); 461 void forwardReliable(const LLHost &host);
451 void forwardReliable(const U32 circuit_code); 462 void forwardReliable(const U32 circuit_code);
452 463
464 LLHTTPClient::ResponderPtr createResponder(const std::string& name);
453 S32 sendMessage(const LLHost &host); 465 S32 sendMessage(const LLHost &host);
454 S32 sendMessage(const U32 circuit); 466 S32 sendMessage(const U32 circuit);
467 S32 sendMessage(const LLHost &host, const char* name,
468 const LLSD& message);
455 469
456 // BOOL decodeData(const U8 *buffer, const LLHost &host); 470 // BOOL decodeData(const U8 *buffer, const LLHost &host);
457 471
@@ -528,6 +542,15 @@ public:
528 // The actual sending is done by reallySendDenyTrustedCircuit() 542 // The actual sending is done by reallySendDenyTrustedCircuit()
529 void sendDenyTrustedCircuit(const LLHost &host); 543 void sendDenyTrustedCircuit(const LLHost &host);
530 544
545 /** Return false if host is unknown or untrusted */
546 bool isTrustedSender(const LLHost& host) const;
547
548 /** Return false true if name is unknown or untrusted */
549 bool isTrustedMessage(const std::string& name) const;
550
551 /** Return false true if name is unknown or trusted */
552 bool isUntrustedMessage(const std::string& name) const;
553
531private: 554private:
532 // A list of the circuits that need to be sent DenyTrustedCircuit messages. 555 // A list of the circuits that need to be sent DenyTrustedCircuit messages.
533 typedef std::set<LLHost> host_set_t; 556 typedef std::set<LLHost> host_set_t;
@@ -537,7 +560,6 @@ private:
537 // related to sendDenyTrustedCircuit() 560 // related to sendDenyTrustedCircuit()
538 void reallySendDenyTrustedCircuit(const LLHost &host); 561 void reallySendDenyTrustedCircuit(const LLHost &host);
539 562
540
541public: 563public:
542 // Use this to establish trust to and from a host. This blocks 564 // Use this to establish trust to and from a host. This blocks
543 // until trust has been established, and probably should only be 565 // until trust has been established, and probably should only be
@@ -594,15 +616,6 @@ public:
594 void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable) 616 void setMaxMessageTime(const F32 seconds); // Max time to process messages before warning and dumping (neg to disable)
595 void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable) 617 void setMaxMessageCounts(const S32 num); // Max number of messages before dumping (neg to disable)
596 618
597 // statics
598 static BOOL isTemplateConfirmed();
599 static BOOL doesTemplateMatch();
600 static void sendMessageTemplateChecksum(const LLHost&);
601 static void processMessageTemplateChecksumReply(LLMessageSystem *msg,
602 void** user_data);
603 static void sendSecureMessageTemplateChecksum(const LLHost&);
604 static void processSecureTemplateChecksumReply(LLMessageSystem *msg,
605 void** user_data);
606 static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds 619 static U64 getMessageTimeUsecs(const BOOL update = FALSE); // Get the current message system time in microseconds
607 static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds 620 static F64 getMessageTimeSeconds(const BOOL update = FALSE); // Get the current message system time in seconds
608 621
@@ -613,6 +626,7 @@ public:
613 //static void processAssignCircuitCode(LLMessageSystem* msg, void**); 626 //static void processAssignCircuitCode(LLMessageSystem* msg, void**);
614 static void processAddCircuitCode(LLMessageSystem* msg, void**); 627 static void processAddCircuitCode(LLMessageSystem* msg, void**);
615 static void processUseCircuitCode(LLMessageSystem* msg, void**); 628 static void processUseCircuitCode(LLMessageSystem* msg, void**);
629 static void processError(LLMessageSystem* msg, void**);
616 630
617 // dispatch llsd message to http node tree 631 // dispatch llsd message to http node tree
618 static void dispatch(const std::string& msg_name, 632 static void dispatch(const std::string& msg_name,
@@ -623,13 +637,33 @@ public:
623 637
624 void setMessageBans(const LLSD& trusted, const LLSD& untrusted); 638 void setMessageBans(const LLSD& trusted, const LLSD& untrusted);
625 639
640 /**
641 * @brief send an error message to the host. This is a helper method.
642 *
643 * @param host Destination host.
644 * @param agent_id Destination agent id (may be null)
645 * @param code An HTTP status compatible error code.
646 * @param token A specific short string based message
647 * @param id The transactionid/uniqueid/sessionid whatever.
648 * @param system The hierarchical path to the system (255 bytes)
649 * @param message Human readable message (1200 bytes)
650 * @param data Extra info.
651 * @return Returns value returned from sendReliable().
652 */
653 S32 sendError(
654 const LLHost& host,
655 const LLUUID& agent_id,
656 S32 code,
657 const std::string& token,
658 const LLUUID& id,
659 const std::string& system,
660 const std::string& message,
661 const LLSD& data);
662
626 // Check UDP messages and pump http_pump to receive HTTP messages. 663 // Check UDP messages and pump http_pump to receive HTTP messages.
627 bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump); 664 bool checkAllMessages(S64 frame_count, LLPumpIO* http_pump);
628 665
629private: 666private:
630 // data used in those internal handlers
631 BOOL mTemplateConfirmed;
632 BOOL mTemplateMatches;
633 667
634 // The mCircuitCodes is a map from circuit codes to session 668 // The mCircuitCodes is a map from circuit codes to session
635 // ids. This allows us to verify sessions on connect. 669 // ids. This allows us to verify sessions on connect.
@@ -639,7 +673,7 @@ private:
639 // Viewers need to track a process session in order to make sure 673 // Viewers need to track a process session in order to make sure
640 // that no one gives them a bad circuit code. 674 // that no one gives them a bad circuit code.
641 LLUUID mSessionID; 675 LLUUID mSessionID;
642 676
643 void addTemplate(LLMessageTemplate *templatep); 677 void addTemplate(LLMessageTemplate *templatep);
644 void clearReceiveState(); 678 void clearReceiveState();
645 BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template ); 679 BOOL decodeTemplate( const U8* buffer, S32 buffer_size, LLMessageTemplate** msg_template );
@@ -710,6 +744,10 @@ private:
710 744
711 bool callHandler(const char *name, bool trustedSource, 745 bool callHandler(const char *name, bool trustedSource,
712 LLMessageSystem* msg); 746 LLMessageSystem* msg);
747
748
749 /** Find, create or revive circuit for host as needed */
750 LLCircuitData* findCircuit(const LLHost& host, bool resetPacketId);
713}; 751};
714 752
715 753