summaryrefslogtreecommitdiff
path: root/indra/llmessage
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2009-11-11 07:41:50 -0500
committerNat Goodspeed <nat@lindenlab.com>2009-11-11 07:41:50 -0500
commit062d0a13db505636b186084d42c527a49637f380 (patch)
treeb2ae497f8b3f0c0829e739e1cca698f5fa21de4c /indra/llmessage
parent43ae94ab0f35dafaa0e1787a155290e371e317a1 (diff)
Add LLEventAPI class, formalizing the mechanism by which we wrap a C++ API
with an event API. In addition to the LLEventPump name on which to listen, LLEventAPI accepts a documentation string for event API introspection. Give every LLEventDispatcher::add() overload a new documentation string parameter for event API introspection. Convert every existing event API to new conventions, introducing suitable documentation strings for the API and each of its operations.
Diffstat (limited to 'indra/llmessage')
-rw-r--r--indra/llmessage/llares.cpp2
-rw-r--r--indra/llmessage/llareslistener.cpp13
-rw-r--r--indra/llmessage/llareslistener.h9
3 files changed, 14 insertions, 10 deletions
diff --git a/indra/llmessage/llares.cpp b/indra/llmessage/llares.cpp
index acbf51d75c..104629c157 100644
--- a/indra/llmessage/llares.cpp
+++ b/indra/llmessage/llares.cpp
@@ -106,7 +106,7 @@ void LLAres::QueryResponder::queryError(int code)
LLAres::LLAres() :
chan_(NULL),
mInitSuccess(false),
- mListener(new LLAresListener("LLAres", this))
+ mListener(new LLAresListener(this))
{
if (ares_init(&chan_) != ARES_SUCCESS)
{
diff --git a/indra/llmessage/llareslistener.cpp b/indra/llmessage/llareslistener.cpp
index a8beb8cbde..7db3675b77 100644
--- a/indra/llmessage/llareslistener.cpp
+++ b/indra/llmessage/llareslistener.cpp
@@ -22,13 +22,18 @@
#include "llevents.h"
#include "llsdutil.h"
-LLAresListener::LLAresListener(const std::string& pumpname, LLAres* llares):
- LLDispatchListener(pumpname, "op"),
+LLAresListener::LLAresListener(LLAres* llares):
+ LLEventAPI("LLAres",
+ "LLAres listener to request DNS operations"),
mAres(llares)
{
// add() every method we want to be able to invoke via this event API.
- // Optional third parameter validates expected LLSD request structure.
- add("rewriteURI", &LLAresListener::rewriteURI,
+ // Optional last parameter validates expected LLSD request structure.
+ add("rewriteURI",
+ "Given [\"uri\"], return on [\"reply\"] an array of alternative URIs.\n"
+ "On failure, returns an array containing only the original URI, so\n"
+ "failure case can be processed like success case.",
+ &LLAresListener::rewriteURI,
LLSD().insert("uri", LLSD()).insert("reply", LLSD()));
}
diff --git a/indra/llmessage/llareslistener.h b/indra/llmessage/llareslistener.h
index bf093b3d3d..33cef79c09 100644
--- a/indra/llmessage/llareslistener.h
+++ b/indra/llmessage/llareslistener.h
@@ -14,18 +14,17 @@
#if ! defined(LL_LLARESLISTENER_H)
#define LL_LLARESLISTENER_H
-#include "lleventdispatcher.h"
+#include "lleventapi.h"
class LLAres;
class LLSD;
/// Listen on an LLEventPump with specified name for LLAres request events.
-class LLAresListener: public LLDispatchListener
+class LLAresListener: public LLEventAPI
{
public:
- /// Specify the pump name on which to listen, and bind the LLAres instance
- /// to use (e.g. gAres)
- LLAresListener(const std::string& pumpname, LLAres* llares);
+ /// Bind the LLAres instance to use (e.g. gAres)
+ LLAresListener(LLAres* llares);
private:
/// command["op"] == "rewriteURI"