1 #define __GANGLIA_MTU     1500
2 #define __UDP_HEADER_SIZE 28
3 #define __MAX_TITLE_LEN 32
4 #define __MAX_GROUPS_LEN 128
5 #define __MAX_DESC_LEN 128
6 %#define UDP_HEADER_SIZE __UDP_HEADER_SIZE
7 %#define MAX_DESC_LEN __MAX_DESC_LEN
8 %#define GM_PROTOCOL_GUARD
9 
10 #define GANGLIA_MAX_XDR_MESSAGE_LEN (__GANGLIA_MTU - __UDP_HEADER_SIZE - 8)
11 
12 enum Ganglia_value_types {
13   GANGLIA_VALUE_UNKNOWN,
14   GANGLIA_VALUE_STRING,
15   GANGLIA_VALUE_UNSIGNED_SHORT,
16   GANGLIA_VALUE_SHORT,
17   GANGLIA_VALUE_UNSIGNED_INT,
18   GANGLIA_VALUE_INT,
19   GANGLIA_VALUE_FLOAT,
20   GANGLIA_VALUE_DOUBLE
21 };
22 
23 /* Structure for transporting extra metadata */
24 struct Ganglia_extra_data {
25   string name<>;
26   string data<>;
27 };
28 
29 struct Ganglia_metadata_message {
30   string type<>;
31   string name<>;
32   string units<>;
33   unsigned int slope;
34   unsigned int tmax;
35   unsigned int dmax;
36   struct Ganglia_extra_data metadata<>;
37 };
38 
39 struct Ganglia_metric_id {
40   string host<>;
41   string name<>;
42   bool spoof;
43 };
44 
45 struct Ganglia_metadatadef {
46   struct Ganglia_metric_id metric_id;
47   struct Ganglia_metadata_message metric;
48 };
49 
50 struct Ganglia_metadatareq {
51   struct Ganglia_metric_id metric_id;
52 };
53 
54 struct Ganglia_gmetric_ushort {
55   struct Ganglia_metric_id metric_id;
56   string fmt<>;
57   unsigned short us;
58 };
59 
60 struct Ganglia_gmetric_short {
61   struct Ganglia_metric_id metric_id;
62   string fmt<>;
63   short ss;
64 };
65 
66 struct Ganglia_gmetric_int {
67   struct Ganglia_metric_id metric_id;
68   string fmt<>;
69   int si;
70 };
71 
72 struct Ganglia_gmetric_uint {
73   struct Ganglia_metric_id metric_id;
74   string fmt<>;
75   unsigned int ui;
76 };
77 
78 struct Ganglia_gmetric_string {
79   struct Ganglia_metric_id metric_id;
80   string fmt<>;
81   string str<>;
82 };
83 
84 struct Ganglia_gmetric_float {
85   struct Ganglia_metric_id metric_id;
86   string fmt<>;
87   float f;
88 };
89 
90 struct Ganglia_gmetric_double {
91   struct Ganglia_metric_id metric_id;
92   string fmt<>;
93   double d;
94 };
95 
96 /* Start the refactored XDR packet ids at 128 to
97 ** avoid confusing the new packets with the older ones.
98 ** this is to avoid trying to decode older XDR packets
99 ** as newer packets if an older version of gmond happens
100 ** to be talking on the same multicast channel.
101 */
102 enum Ganglia_msg_formats {
103    gmetadata_full = 128,
104    gmetric_ushort,
105    gmetric_short,
106    gmetric_int,
107    gmetric_uint,
108    gmetric_string,
109    gmetric_float,
110    gmetric_double,
111    gmetadata_request
112 };
113 
114 union Ganglia_metadata_msg switch (Ganglia_msg_formats id) {
115   case gmetadata_full:
116     Ganglia_metadatadef gfull;
117   case gmetadata_request:
118     Ganglia_metadatareq grequest;
119 
120   default:
121     void;
122 };
123 
124 union Ganglia_value_msg switch (Ganglia_msg_formats id) {
125   case gmetric_ushort:
126     Ganglia_gmetric_ushort gu_short;
127   case gmetric_short:
128     Ganglia_gmetric_short gs_short;
129   case gmetric_int:
130     Ganglia_gmetric_int gs_int;
131   case gmetric_uint:
132     Ganglia_gmetric_uint gu_int;
133   case gmetric_string:
134     Ganglia_gmetric_string gstr;
135   case gmetric_float:
136     Ganglia_gmetric_float gf;
137   case gmetric_double:
138     Ganglia_gmetric_double gd;
139 
140   default:
141     void;
142 };
143 
144 struct Ganglia_25metric
145 {
146    int key;
147    string name<16>;
148    int tmax;
149    Ganglia_value_types type;
150    string units<32>;
151    string slope<32>;
152    string fmt<32>;
153    int msg_size;
154    string desc<__MAX_DESC_LEN>;
155    int *metadata;
156 };
157 
158 #ifdef RPC_HDR
159 % #define GANGLIA_MAX_MESSAGE_LEN GANGLIA_MAX_XDR_MESSAGE_LEN
160 
161 /* This is a place holder for the key field
162  *  in the Ganglia_25metric structure. For now the only
163  *  type of metric is modular.
164  */
165 %#define modular_metric 4098
166 #endif
167 
168