summaryrefslogtreecommitdiff
path: root/apps/Gateway/Peer/Peer_Message.h
blob: 67f57f148cb35673c91da997267ece06babd3783 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
/* -*- C++ -*- */
// $Id$

// Define the Peer message schema (this may change).

#if !defined (PEER_MESSAGE)
#define PEER_MESSAGE

// Fixed sized header.

class Peer_Header
{
public:
// Type used to route messages from gatewayd.
  typedef short ROUTING_ID;

  enum
  {
    INVALID_ID = -1 // No peer may use this number.
  };

  // Source ID.
  ROUTING_ID routing_id_;

  // Length of the message in bytes.
  size_t  len_;
};

// Variable-sized message (buf_ may be variable-sized between
// 0 and MAX_PAYLOAD_SIZE).

class Peer_Message
{
public:
  // The maximum size of an Peer message (see Peer protocol specs for exact #).
  enum { MAX_PAYLOAD_SIZE = 1024 };

  Peer_Header header_;

  // Message payload
  char buf_[MAX_PAYLOAD_SIZE];
};

#endif /* PEER_MESSAGE */