summaryrefslogtreecommitdiff
path: root/apps/Gateway/Peer/Event.h
diff options
context:
space:
mode:
Diffstat (limited to 'apps/Gateway/Peer/Event.h')
-rw-r--r--apps/Gateway/Peer/Event.h38
1 files changed, 31 insertions, 7 deletions
diff --git a/apps/Gateway/Peer/Event.h b/apps/Gateway/Peer/Event.h
index 24881c3e85b..5e288edf910 100644
--- a/apps/Gateway/Peer/Event.h
+++ b/apps/Gateway/Peer/Event.h
@@ -23,7 +23,7 @@
// Proxy_Handler in the Gateway.
typedef ACE_INT32 ACE_INT32;
-class Event_Addr
+class Event_Key
// = TITLE
// Address used to identify the source/destination of an event.
//
@@ -33,14 +33,14 @@ class Event_Addr
// Channel from the format of the data.
{
public:
- Event_Addr (ACE_INT32 cid = -1,
+ Event_Key (ACE_INT32 cid = -1,
u_char sid = 0,
u_char type = 0)
: conn_id_ (cid),
supplier_id_ (sid),
type_ (type) {}
- int operator== (const Event_Addr &event_addr) const
+ int operator== (const Event_Key &event_addr) const
{
return this->conn_id_ == event_addr.conn_id_
&& this->supplier_id_ == event_addr.supplier_id_
@@ -58,10 +58,13 @@ public:
// Event type.
};
-
class Event_Header
// = TITLE
- // Fixed sized header.
+ // Fixed sized header.
+ //
+ // = DESCRIPTION
+ // This is designed to have a sizeof (16) to avoid alignment
+ // problems on most platforms.
{
public:
typedef ACE_INT32 SUPPLIER_ID;
@@ -72,14 +75,35 @@ public:
INVALID_ID = -1 // No peer can validly use this number.
};
+ void decode (void)
+ {
+ this->len_ = ntohl (this->len_);
+ this->supplier_id_ = ntohl (this->supplier_id_);
+ this->type_ = ntohl (this->type_);
+ this->priority_ = ntohl (this->priority_);
+ }
+ // Decode from network byte order to host byte order.
+
+ void encode (void)
+ {
+ this->len_ = htonl (this->len_);
+ this->supplier_id_ = htonl (this->supplier_id_);
+ this->type_ = htonl (this->type_);
+ this->priority_ = htonl (this->priority_);
+ }
+ // Encode from host byte order to network byte order.
+
+ size_t len_;
+ // Length of the data_ payload, in bytes.
+
SUPPLIER_ID supplier_id_;
// Source ID.
ACE_INT32 type_;
// Event type.
- size_t len_;
- // Length of the entire event (including data payload) in bytes.
+ ACE_INT32 priority_;
+ // Event priority.
};
class Event