trisulrp 1.2.5 → 1.2.6

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.5
1
+ 1.2.6
data/lib/trisulrp/keys.rb CHANGED
@@ -197,4 +197,72 @@ class ASNumber
197
197
  end
198
198
  end
199
199
 
200
+ # convert a trisul key format into a human readable key
201
+ # [keyform] the key form
202
+ #
203
+ # ==== Typical use
204
+ #
205
+ # Used to convert an IP / Port or any other trisul key into a readable form
206
+ #
207
+ # <code>
208
+ #
209
+ # make_readable("C0.A8.0C.A0") => "192.168.12.160"
210
+ #
211
+ # make_readable("p-0016") => "Port-22"
212
+ #
213
+ # </code>
214
+ #
215
+ #
216
+ #
217
+ # Also see TrisulRP::Protocol::get_labels_for_keys to obtain a text name for the key
218
+ #
219
+ # Also see the inverse of this method make_key which convert a readable string into a key
220
+ # suitable for use in TRP request messages.
221
+ #
222
+ # If key type cannot be accurately guessed it returns the input
223
+ #
224
+ def make_readable(keyform)
225
+ [ TrisulRP::Keys::Port,
226
+ TrisulRP::Keys::Host,
227
+ TrisulRP::Keys::HostInterface,
228
+ TrisulRP::Keys::Subnet,
229
+ TrisulRP::Keys::ASNumber
230
+ ].each do |kls|
231
+ return kls.xform(keyform) if kls.is_key_form?(keyform)
232
+ end
233
+ return keyform
234
+ end
235
+
236
+
237
+ # convert a key in human form into trisul key format
238
+ #
239
+ # [humanform] the human form of the key
240
+ #
241
+ # ==== Typical use
242
+ #
243
+ # Used to convert a human form key into a Trisul Key format suitable for use with TRP requests
244
+ #
245
+ #
246
+ # <code>
247
+ #
248
+ # make_key("192.168.1.1") => "C0.A8.01.01"
249
+ #
250
+ # </code>
251
+ #
252
+ #
253
+ # Also see the inverse of this method make_readable
254
+ #
255
+ #
256
+ def make_key(readable)
257
+ [ TrisulRP::Keys::Port,
258
+ TrisulRP::Keys::Host,
259
+ TrisulRP::Keys::HostInterface,
260
+ TrisulRP::Keys::Subnet,
261
+ TrisulRP::Keys::ASNumber
262
+ ].each do |kls|
263
+ return kls.invert_xform(readable) if kls.is_human_form?(readable)
264
+ end
265
+ return readable
266
+ end
267
+
200
268
  end
@@ -66,12 +66,12 @@ module TrisulRP::Protocol
66
66
  def get_response(conn,trp_request)
67
67
  outbuf=""
68
68
  outbuf=trp_request.serialize_to_string
69
- trp_socket.write([outbuf.length].pack("N*"))
70
- trp_socket.write(outbuf)
71
- inbuf = trp_socket.read(4)
69
+ conn.write([outbuf.length].pack("N*"))
70
+ conn.write(outbuf)
71
+ inbuf = conn.read(4)
72
72
  buflenarr=inbuf.unpack("N*")
73
73
  datalen=buflenarr[0]
74
- dataarray=trp_socket.read(datalen)
74
+ dataarray=conn.read(datalen)
75
75
  resp =TRP::Message.new
76
76
  resp.parse dataarray
77
77
  raise resp.error_response if resp.trp_command == TRP::Message::Command::ERROR_RESPONSE
@@ -275,11 +275,12 @@ module TRP
275
275
 
276
276
  class HelloResponse < ::ProtocolBuffers::Message
277
277
  required :string, :trisul_id, 1
278
- required :string, :connection_id, 2
279
- required :string, :version_string, 3
280
- required ::TRP::Timestamp, :connection_start_time, 4
281
- required ::TRP::Timestamp, :connection_up_time, 5
282
- required ::TRP::AuthLevel, :current_auth_level, 6
278
+ required :string, :trisul_description, 2
279
+ required :string, :connection_id, 3
280
+ required :string, :version_string, 4
281
+ required ::TRP::Timestamp, :connection_start_time, 5
282
+ required ::TRP::Timestamp, :connection_up_time, 6
283
+ required ::TRP::AuthLevel, :current_auth_level, 7
283
284
 
284
285
  gen_methods! # new fields ignored after this point
285
286
  end
@@ -1,7 +1,7 @@
1
1
  // Trisul Remote Protocol (TRP) definition
2
2
  // Based on Google Protocol Buffers
3
3
  // (c) 2010-11, Unleash Networks
4
- //
4
+ // $Rev: 3442 $
5
5
  package TRP;
6
6
 
7
7
  message Timestamp {
@@ -10,184 +10,185 @@ message Timestamp {
10
10
  }
11
11
 
12
12
  message TimeInterval {
13
- required Timestamp from=1;
14
- required Timestamp to=2;
13
+ required Timestamp from=1;
14
+ required Timestamp to=2;
15
15
  }
16
16
 
17
17
  message StatsTuple {
18
- required Timestamp ts=1;
19
- required double val=2;
18
+ required Timestamp ts=1;
19
+ required double val=2;
20
20
  }
21
21
 
22
22
  message MeterValues {
23
- required int32 meter=1;
24
- repeated StatsTuple values=2;
23
+ required int32 meter=1;
24
+ repeated StatsTuple values=2;
25
25
  }
26
26
 
27
27
  message KeyStats {
28
- optional int64 context=1[default=0];
29
- required string counter_group=2;
30
- required string key=3;
31
- repeated MeterValues meters=4;
28
+ optional int64 context=1[default=0];
29
+ required string counter_group=2;
30
+ required string key=3;
31
+ repeated MeterValues meters=4;
32
32
  }
33
33
 
34
34
  message KeyDetails {
35
- required string key=1;
36
- optional string label=2;
37
- optional string description=3;
35
+ required string key=1;
36
+ optional string label=2;
37
+ optional string description=3;
38
38
  }
39
39
 
40
40
  message SessionID {
41
- required int64 slice_id=1;
42
- required int64 session_id=2;
41
+ required int64 slice_id=1;
42
+ required int64 session_id=2;
43
43
  }
44
44
 
45
45
  message AlertID {
46
- required int64 slice_id=1;
47
- required int64 alert_id=2;
46
+ required int64 slice_id=1;
47
+ required int64 alert_id=2;
48
48
  }
49
49
 
50
50
  message ResourceID {
51
- required int64 slice_id=1;
52
- required int64 resource_id=2;
51
+ required int64 slice_id=1;
52
+ required int64 resource_id=2;
53
53
  }
54
54
  message CounterGroupDetails {
55
- required string guid=1;
56
- required string name=2;
57
- optional int64 bucket_size=3;
58
- optional TimeInterval time_interval=4;
55
+ required string guid=1;
56
+ required string name=2;
57
+ optional int64 bucket_size=3;
58
+ optional TimeInterval time_interval=4;
59
59
  }
60
60
 
61
61
  enum AuthLevel {
62
- ADMIN=1;
63
- BASIC_USER=2;
64
- FORENSIC_USER=3;
65
- BLOCKED_USER=4;
62
+ ADMIN=1;
63
+ BASIC_USER=2;
64
+ FORENSIC_USER=3;
65
+ BLOCKED_USER=4;
66
66
  }
67
67
 
68
68
  enum CompressionType {
69
- UNCOMPRESSED=1;
70
- GZIP=2;
69
+ UNCOMPRESSED=1;
70
+ GZIP=2;
71
71
  }
72
72
 
73
73
  enum PcapFormat {
74
- LIBPCAP=1;
75
- UNSNIFF=2;
74
+ LIBPCAP=1;
75
+ UNSNIFF=2;
76
76
  }
77
77
 
78
78
  message Message {
79
- enum Command { HELLO_REQUEST=1;
80
- HELLO_RESPONSE=2;
81
- OK_RESPONSE=3;
82
- ERROR_RESPONSE=5;
83
- COUNTER_GROUP_REQUEST=6;
84
- COUNTER_GROUP_RESPONSE=7;
85
- COUNTER_ITEM_REQUEST=8;
86
- COUNTER_ITEM_RESPONSE=9;
87
- RELEASE_RESOURCE_REQUEST=10;
88
- RELEASE_CONTEXT_REQUEST=11;
89
- CONTROLLED_COUNTER_GROUP_REQUEST=12;
90
- CONTROLLED_COUNTER_GROUP_RESPONSE=13;
91
- FILTERED_DATAGRAMS_REQUEST=14;
92
- FILTERED_DATAGRAMS_RESPONSE=15;
93
- CONTROLLED_CONTEXT_REQUEST=16;
94
- CONTROLLED_CONTEXT_RESPONSE=17;
95
- SEARCH_KEYS_REQUEST=18;
96
- SEARCH_KEYS_RESPONSE=19;
97
- COUNTER_GROUP_INFO_REQUEST=20;
98
- COUNTER_GROUP_INFO_RESPONSE=21;
99
- SESSION_TRACKER_REQUEST=22;
100
- SESSION_TRACKER_RESPONSE=23;
101
- SESSION_ITEM_REQUEST=24;
102
- SESSION_ITEM_RESPONSE=25;
103
- BULK_COUNTER_ITEM_REQUEST=26;
104
- BULK_COUNTER_ITEM_RESPONSE=27;
105
- CGMONITOR_REQUEST=28;
106
- CGMONITOR_RESPONSE=29;
107
- TOPPER_SNAPSHOT_REQUEST=30;
108
- TOPPER_SNAPSHOT_RESPONSE=31;
109
- UPDATE_KEY_REQUEST=32;
110
- UPDATE_KEY_RESPONSE=33;
111
- KEY_SESS_ACTIVITY_REQUEST=34;
112
- KEY_SESS_ACTIVITY_RESPONSE=35;
113
- RING_STATS_REQUEST=36;
114
- RING_STATS_RESPONSE=37;
115
- SERVER_STATS_REQUEST=38;
116
- SERVER_STATS_RESPONSE=39;
117
- SESSION_GROUP_REQUEST=40;
118
- SESSION_GROUP_RESPONSE=41;
119
- ALERT_ITEM_REQUEST=42;
120
- ALERT_ITEM_RESPONSE=43;
121
- ALERT_GROUP_REQUEST=44;
122
- ALERT_GROUP_RESPONSE=45;
123
- RESOURCE_ITEM_REQUEST=46;
124
- RESOURCE_ITEM_RESPONSE=47;
125
- RESOURCE_GROUP_REQUEST=48;
126
- RESOURCE_GROUP_RESPONSE=49;
127
- KEY_LOOKUP_REQUEST=50;
128
- KEY_LOOKUP_RESPONSE=51;
129
- }
130
-
131
- required Command trp_command=1;
132
- optional HelloRequest hello_request=2;
133
- optional HelloResponse hello_response=3;
134
- optional OKResponse ok_response=4;
135
- optional ErrorResponse error_response=5;
136
- optional CounterGroupRequest counter_group_request=6;
137
- optional CounterGroupResponse counter_group_response=7;
138
- optional CounterItemRequest counter_item_request=8;
139
- optional CounterItemResponse counter_item_response=9;
140
- optional ReleaseContextRequest release_context_request=11;
141
- optional ControlledCounterGroupRequest controlled_counter_group_request=12;
142
- optional ControlledCounterGroupResponse controlled_counter_group_response=13;
143
- optional FilteredDatagramRequest filtered_datagram_request=14;
144
- optional FilteredDatagramResponse filtered_datagram_response=15;
145
- optional ControlledContextRequest controlled_context_request=16;
146
- optional ControlledContextResponse controlled_context_response=17;
147
- optional SearchKeysRequest search_keys_request=18;
148
- optional SearchKeysResponse search_keys_response=19;
149
- optional CounterGroupInfoRequest counter_group_info_request=20;
150
- optional CounterGroupInfoResponse counter_group_info_response=21;
151
- optional SessionItemRequest session_item_request=22;
152
- optional SessionItemResponse session_item_response=23;
153
- optional BulkCounterItemRequest bulk_counter_item_request=24;
154
- optional BulkCounterItemResponse bulk_counter_item_response=25;
155
- optional TopperSnapshotRequest topper_snapshot_request=28;
156
- optional TopperSnapshotResponse topper_snapshot_response=29;
157
- optional UpdateKeyRequest update_key_request=30;
158
- optional KeySessionActivityRequest key_session_activity_request=31;
159
- optional KeySessionActivityResponse key_session_activity_response=32;
160
- optional SessionTrackerRequest session_tracker_request=33;
161
- optional SessionTrackerResponse session_tracker_response=34;
162
- optional ServerStatsRequest server_stats_request=37;
163
- optional ServerStatsResponse server_stats_response=38;
164
- optional SessionGroupRequest session_group_request=39;
165
- optional SessionGroupResponse session_group_response=40;
166
- optional AlertItemRequest alert_item_request=41;
167
- optional AlertItemResponse alert_item_response=42;
168
- optional AlertGroupRequest alert_group_request=43;
169
- optional AlertGroupResponse alert_group_response=44;
170
- optional ResourceItemRequest resource_item_request=45;
171
- optional ResourceItemResponse resource_item_response=46;
172
- optional ResourceGroupRequest resource_group_request=47;
173
- optional ResourceGroupResponse resource_group_response=48;
174
- optional KeyLookupRequest key_lookup_request=49;
175
- optional KeyLookupResponse key_lookup_response=50;
79
+ enum Command { HELLO_REQUEST=1;
80
+ HELLO_RESPONSE=2;
81
+ OK_RESPONSE=3;
82
+ ERROR_RESPONSE=5;
83
+ COUNTER_GROUP_REQUEST=6;
84
+ COUNTER_GROUP_RESPONSE=7;
85
+ COUNTER_ITEM_REQUEST=8;
86
+ COUNTER_ITEM_RESPONSE=9;
87
+ RELEASE_RESOURCE_REQUEST=10;
88
+ RELEASE_CONTEXT_REQUEST=11;
89
+ CONTROLLED_COUNTER_GROUP_REQUEST=12;
90
+ CONTROLLED_COUNTER_GROUP_RESPONSE=13;
91
+ FILTERED_DATAGRAMS_REQUEST=14;
92
+ FILTERED_DATAGRAMS_RESPONSE=15;
93
+ CONTROLLED_CONTEXT_REQUEST=16;
94
+ CONTROLLED_CONTEXT_RESPONSE=17;
95
+ SEARCH_KEYS_REQUEST=18;
96
+ SEARCH_KEYS_RESPONSE=19;
97
+ COUNTER_GROUP_INFO_REQUEST=20;
98
+ COUNTER_GROUP_INFO_RESPONSE=21;
99
+ SESSION_TRACKER_REQUEST=22;
100
+ SESSION_TRACKER_RESPONSE=23;
101
+ SESSION_ITEM_REQUEST=24;
102
+ SESSION_ITEM_RESPONSE=25;
103
+ BULK_COUNTER_ITEM_REQUEST=26;
104
+ BULK_COUNTER_ITEM_RESPONSE=27;
105
+ CGMONITOR_REQUEST=28;
106
+ CGMONITOR_RESPONSE=29;
107
+ TOPPER_SNAPSHOT_REQUEST=30;
108
+ TOPPER_SNAPSHOT_RESPONSE=31;
109
+ UPDATE_KEY_REQUEST=32;
110
+ UPDATE_KEY_RESPONSE=33;
111
+ KEY_SESS_ACTIVITY_REQUEST=34;
112
+ KEY_SESS_ACTIVITY_RESPONSE=35;
113
+ RING_STATS_REQUEST=36;
114
+ RING_STATS_RESPONSE=37;
115
+ SERVER_STATS_REQUEST=38;
116
+ SERVER_STATS_RESPONSE=39;
117
+ SESSION_GROUP_REQUEST=40;
118
+ SESSION_GROUP_RESPONSE=41;
119
+ ALERT_ITEM_REQUEST=42;
120
+ ALERT_ITEM_RESPONSE=43;
121
+ ALERT_GROUP_REQUEST=44;
122
+ ALERT_GROUP_RESPONSE=45;
123
+ RESOURCE_ITEM_REQUEST=46;
124
+ RESOURCE_ITEM_RESPONSE=47;
125
+ RESOURCE_GROUP_REQUEST=48;
126
+ RESOURCE_GROUP_RESPONSE=49;
127
+ KEY_LOOKUP_REQUEST=50;
128
+ KEY_LOOKUP_RESPONSE=51;
129
+ }
130
+
131
+ required Command trp_command=1;
132
+ optional HelloRequest hello_request=2;
133
+ optional HelloResponse hello_response=3;
134
+ optional OKResponse ok_response=4;
135
+ optional ErrorResponse error_response=5;
136
+ optional CounterGroupRequest counter_group_request=6;
137
+ optional CounterGroupResponse counter_group_response=7;
138
+ optional CounterItemRequest counter_item_request=8;
139
+ optional CounterItemResponse counter_item_response=9;
140
+ optional ReleaseContextRequest release_context_request=11;
141
+ optional ControlledCounterGroupRequest controlled_counter_group_request=12;
142
+ optional ControlledCounterGroupResponse controlled_counter_group_response=13;
143
+ optional FilteredDatagramRequest filtered_datagram_request=14;
144
+ optional FilteredDatagramResponse filtered_datagram_response=15;
145
+ optional ControlledContextRequest controlled_context_request=16;
146
+ optional ControlledContextResponse controlled_context_response=17;
147
+ optional SearchKeysRequest search_keys_request=18;
148
+ optional SearchKeysResponse search_keys_response=19;
149
+ optional CounterGroupInfoRequest counter_group_info_request=20;
150
+ optional CounterGroupInfoResponse counter_group_info_response=21;
151
+ optional SessionItemRequest session_item_request=22;
152
+ optional SessionItemResponse session_item_response=23;
153
+ optional BulkCounterItemRequest bulk_counter_item_request=24;
154
+ optional BulkCounterItemResponse bulk_counter_item_response=25;
155
+ optional TopperSnapshotRequest topper_snapshot_request=28;
156
+ optional TopperSnapshotResponse topper_snapshot_response=29;
157
+ optional UpdateKeyRequest update_key_request=30;
158
+ optional KeySessionActivityRequest key_session_activity_request=31;
159
+ optional KeySessionActivityResponse key_session_activity_response=32;
160
+ optional SessionTrackerRequest session_tracker_request=33;
161
+ optional SessionTrackerResponse session_tracker_response=34;
162
+ optional ServerStatsRequest server_stats_request=37;
163
+ optional ServerStatsResponse server_stats_response=38;
164
+ optional SessionGroupRequest session_group_request=39;
165
+ optional SessionGroupResponse session_group_response=40;
166
+ optional AlertItemRequest alert_item_request=41;
167
+ optional AlertItemResponse alert_item_response=42;
168
+ optional AlertGroupRequest alert_group_request=43;
169
+ optional AlertGroupResponse alert_group_response=44;
170
+ optional ResourceItemRequest resource_item_request=45;
171
+ optional ResourceItemResponse resource_item_response=46;
172
+ optional ResourceGroupRequest resource_group_request=47;
173
+ optional ResourceGroupResponse resource_group_response=48;
174
+ optional KeyLookupRequest key_lookup_request=49;
175
+ optional KeyLookupResponse key_lookup_response=50;
176
176
  }
177
177
 
178
178
  ///////////////////////////////
179
179
  // Hello
180
180
  message HelloRequest{
181
- required string station_id=1;
182
- }
181
+ required string station_id=1;
182
+ }
183
183
 
184
184
  message HelloResponse{
185
- required string trisul_id=1;
186
- required string connection_id=2;
187
- required string version_string=3;
188
- required Timestamp connection_start_time=4;
189
- required Timestamp connection_up_time=5;
190
- required AuthLevel current_auth_level=6;
185
+ required string trisul_id=1;
186
+ required string trisul_description=2;
187
+ required string connection_id=3;
188
+ required string version_string=4;
189
+ required Timestamp connection_start_time=5;
190
+ required Timestamp connection_up_time=6;
191
+ required AuthLevel current_auth_level=7;
191
192
  }
192
193
 
193
194
  ///////////////////////////////
@@ -201,400 +202,400 @@ message ErrorResponse{
201
202
  ///////////////////////////////
202
203
  // OK
203
204
  message OKResponse{
204
- required int64 original_command=1;
205
- optional string message=2;
205
+ required int64 original_command=1;
206
+ optional string message=2;
206
207
  }
207
208
 
208
209
  message ReleaseContextRequest{
209
- optional int64 context=1;
210
+ optional int64 context=1;
210
211
  }
211
212
 
212
213
  ///////////////////////////////
213
214
  // CounterItemRequest
214
215
  message CounterItemRequest{
215
- optional int64 context=1 [default=0];
216
- required string counter_group=2;
217
- required int64 meter=3 [default=0];
218
- required string key=4;
219
- required TimeInterval time_interval=5;
216
+ optional int64 context=1 [default=0];
217
+ required string counter_group=2;
218
+ required int64 meter=3 [default=0];
219
+ required string key=4;
220
+ required TimeInterval time_interval=5;
220
221
  }
221
222
 
222
223
  ///////////////////////////////
223
224
  // CounterItemResponse
224
225
  message CounterItemResponse{
225
- required KeyStats stats=1;
226
+ required KeyStats stats=1;
226
227
  }
227
228
 
228
229
  ///////////////////////////////
229
230
  // CounterGroupRequest
230
231
  message CounterGroupRequest{
231
- optional int64 context=1 [default=0];
232
- required string counter_group=2;
233
- optional int64 meter=3 [default=0];
234
- optional int64 maxitems=4 [default=10];
235
- optional TimeInterval time_interval=5;
236
- optional Timestamp time_instant=6;
237
- optional int64 flags=7;
232
+ optional int64 context=1 [default=0];
233
+ required string counter_group=2;
234
+ optional int64 meter=3 [default=0];
235
+ optional int64 maxitems=4 [default=10];
236
+ optional TimeInterval time_interval=5;
237
+ optional Timestamp time_instant=6;
238
+ optional int64 flags=7;
238
239
  }
239
240
 
240
241
  ///////////////////////////////
241
242
  // CounterItemRequest
242
243
  message CounterGroupResponse{
243
- required int64 context=1;
244
- required string counter_group=2;
245
- required int64 meter=3;
246
- repeated KeyDetails keys=6;
244
+ required int64 context=1;
245
+ required string counter_group=2;
246
+ required int64 meter=3;
247
+ repeated KeyDetails keys=6;
247
248
  }
248
249
 
249
250
  message ControlledCounterGroupRequest{
250
- required string dynamic_group_id=1;
251
- required string counter_group=2;
252
- required int64 meter=3;
253
- required int64 maxitems=4;
254
- required int64 bucket_ms=5;
255
- required int64 top_nsize=6;
256
- required TimeInterval time_interval=7;
257
- required string control_counter_id=9;
258
- required string control_key=10;
251
+ required string dynamic_group_id=1;
252
+ required string counter_group=2;
253
+ required int64 meter=3;
254
+ required int64 maxitems=4;
255
+ required int64 bucket_ms=5;
256
+ required int64 top_nsize=6;
257
+ required TimeInterval time_interval=7;
258
+ required string control_counter_id=9;
259
+ required string control_key=10;
259
260
  }
260
261
 
261
262
  message ControlledCounterGroupResponse{
262
- required string dynamic_group_id=1;
263
+ required string dynamic_group_id=1;
263
264
  }
264
265
 
265
266
 
266
267
  ///////////////////////////////
267
268
  // FilteredDatagramRequest
268
269
  message FilteredDatagramRequest{
269
- optional int64 max_packets=1[default=0];
270
- optional int64 max_bytes=2[default=0];
271
- optional CompressionType compress_type=3[default=UNCOMPRESSED];
272
- required TimeInterval time_interval=4;
273
- required string filter_expression=5;
270
+ optional int64 max_packets=1[default=0];
271
+ optional int64 max_bytes=2[default=0];
272
+ optional CompressionType compress_type=3[default=UNCOMPRESSED];
273
+ required TimeInterval time_interval=4;
274
+ required string filter_expression=5;
274
275
  }
275
276
 
276
277
  /////////////////////////////////////
277
278
  // FileredDatagaramResponse
278
279
  message FilteredDatagramResponse{
279
- required PcapFormat format=1;
280
- required CompressionType compress_type=2;
281
- required TimeInterval time_interval=3;
282
- required int64 num_datagrams=4;
283
- required int64 num_bytes=5;
284
- required string sha1=6;
285
- required bytes contents=7;
280
+ required PcapFormat format=1;
281
+ required CompressionType compress_type=2;
282
+ required TimeInterval time_interval=3;
283
+ required int64 num_datagrams=4;
284
+ required int64 num_bytes=5;
285
+ required string sha1=6;
286
+ required bytes contents=7;
286
287
  }
287
288
 
288
289
  //////////////////////////////////////////
289
290
  // ControlledContextRequest
290
291
  message ControlledContextRequest{
291
- required TimeInterval time_interval=1;
292
- required string filter_expression=2;
292
+ required TimeInterval time_interval=1;
293
+ required string filter_expression=2;
293
294
  }
294
295
 
295
296
  //////////////////////////////////////////
296
297
  //// ControlledContextResponse
297
298
  message ControlledContextResponse{
298
- required int64 context=1;
299
- optional string context_db=2;
300
- required TimeInterval time_interval =3;
299
+ required int64 context=1;
300
+ optional string context_db=2;
301
+ required TimeInterval time_interval =3;
301
302
  }
302
303
 
303
304
  ///////////////////////////////////////
304
305
  // SearchkeysRequest
305
306
  message SearchKeysRequest{
306
- optional int64 context=1[default=0];
307
- required string counter_group=2;
308
- required string pattern=3;
309
- required int64 maxitems=4;
307
+ optional int64 context=1[default=0];
308
+ required string counter_group=2;
309
+ required string pattern=3;
310
+ required int64 maxitems=4;
310
311
  }
311
312
 
312
313
  //////////////////////////////////////
313
314
  // SearchKeysResponse
314
315
  message SearchKeysResponse{
315
- optional int64 context=1;
316
- required string counter_group=2;
317
- repeated KeyDetails found_keys=3;
316
+ optional int64 context=1;
317
+ required string counter_group=2;
318
+ repeated KeyDetails found_keys=3;
318
319
  }
319
320
 
320
321
  /////////////////////////////////////
321
322
  /// CounterGroupInfoRequest
322
323
  message CounterGroupInfoRequest{
323
- optional int64 context=1[default=0];
324
- optional string counter_group=2;
324
+ optional int64 context=1[default=0];
325
+ optional string counter_group=2;
325
326
  }
326
327
 
327
328
  ///////////////////////////////////
328
329
  /// CounterGroupInfoResponse
329
330
  message CounterGroupInfoResponse{
330
- optional int64 context=1;
331
- repeated CounterGroupDetails group_details=2;
331
+ optional int64 context=1;
332
+ repeated CounterGroupDetails group_details=2;
332
333
  }
333
334
 
334
335
  /////////////////////////////////////
335
336
  // SessionItemRequest
336
337
  message SessionItemRequest{
337
- optional int64 context=1[default=0];
338
- optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
339
- repeated string session_keys=3;
340
- repeated SessionID session_ids=4;
338
+ optional int64 context=1[default=0];
339
+ optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
340
+ repeated string session_keys=3;
341
+ repeated SessionID session_ids=4;
341
342
  }
342
343
 
343
344
  ////////////////////////////////////
344
345
  // SessionItemResponse
345
346
  message SessionItemResponse{
346
- optional int64 context=1[default=0];
347
- required string session_group=2;
348
-
349
- message Item {
350
- optional string session_key=1;
351
- optional SessionID session_id=2;
352
- optional string user_label=3;
353
- required TimeInterval time_interval=4;
354
- required int64 state=5;
355
- required int64 az_bytes=6;
356
- required int64 za_bytes=7;
357
- required KeyDetails key1A=8;
358
- required KeyDetails key2A=9;
359
- required KeyDetails key1Z=10;
360
- required KeyDetails key2Z=11;
361
- }
362
-
363
- repeated Item items=3;
347
+ optional int64 context=1[default=0];
348
+ required string session_group=2;
349
+
350
+ message Item {
351
+ optional string session_key=1;
352
+ optional SessionID session_id=2;
353
+ optional string user_label=3;
354
+ required TimeInterval time_interval=4;
355
+ required int64 state=5;
356
+ required int64 az_bytes=6;
357
+ required int64 za_bytes=7;
358
+ required KeyDetails key1A=8;
359
+ required KeyDetails key2A=9;
360
+ required KeyDetails key1Z=10;
361
+ required KeyDetails key2Z=11;
362
+ }
363
+
364
+ repeated Item items=3;
364
365
  }
365
366
 
366
367
  //////////////////////////////////////////
367
368
  // BulkCounterItemRequest
368
369
  message BulkCounterItemRequest{
369
- optional int64 context=1[default=0];
370
- required string counter_group=2;
371
- required int64 meter=3;
372
- required TimeInterval time_interval=4;
373
- repeated string keys=5;
370
+ optional int64 context=1[default=0];
371
+ required string counter_group=2;
372
+ required int64 meter=3;
373
+ required TimeInterval time_interval=4;
374
+ repeated string keys=5;
374
375
  }
375
376
 
376
377
  //////////////////////////////////////////
377
378
  // BulkCounterItemResponse
378
379
  message BulkCounterItemResponse{
379
- repeated KeyStats stats=1;
380
- repeated KeyDetails details=2;
380
+ repeated KeyStats stats=1;
381
+ repeated KeyDetails details=2;
381
382
  }
382
383
 
383
384
  ///////////////////////////////////////////
384
385
  /// TopperSnapshotRequest
385
386
  message TopperSnapshotRequest{
386
- optional int64 context=1[default=0];
387
- required string counter_group=2;
388
- required int64 meter=3;
389
- required TimeInterval Time=4;
390
- required int64 maxitems=5;
387
+ optional int64 context=1[default=0];
388
+ required string counter_group=2;
389
+ required int64 meter=3;
390
+ required TimeInterval Time=4;
391
+ required int64 maxitems=5;
391
392
  }
392
393
 
393
394
 
394
395
  ///////////////////////////////////////////
395
396
  // TopperSnapshotResponse
396
397
  message TopperSnapshotResponse{
397
- optional int64 context=1;
398
- required string counter_group=2;
399
- required int64 meter=3;
400
- required Timestamp time=4;
401
- required int64 window_secs=5;
402
- required string keys=6;
403
- required string labels=7;
398
+ optional int64 context=1;
399
+ required string counter_group=2;
400
+ required int64 meter=3;
401
+ required Timestamp time=4;
402
+ required int64 window_secs=5;
403
+ required string keys=6;
404
+ required string labels=7;
404
405
  }
405
406
 
406
407
  //////////////////////////////////////////////
407
408
  /// UpdatekeysRequest
408
409
  /// Response = OKResponse or ErrorResponse
409
410
  message UpdateKeyRequest{
410
- optional int64 context=1[default=0];
411
- required string counter_group=2;
412
- required string key=4;
413
- required string label=5;
414
- optional string description=6;
411
+ optional int64 context=1[default=0];
412
+ required string counter_group=2;
413
+ required string key=4;
414
+ required string label=5;
415
+ optional string description=6;
415
416
  }
416
417
 
417
418
  ///////////////////////////////////
418
419
  // KeySessionActivityrequest
419
420
  message KeySessionActivityRequest{
420
- optional int64 context=1[default=0];
421
- optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
422
- required string key=3;
423
- optional int64 maxitems=4[default=100];
424
- optional int64 volume_filter=5[default=0];
425
- optional int64 duration_filter=6[default=0];
426
- required TimeInterval time_interval=7;
421
+ optional int64 context=1[default=0];
422
+ optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
423
+ required string key=3;
424
+ optional int64 maxitems=4[default=100];
425
+ optional int64 volume_filter=5[default=0];
426
+ optional int64 duration_filter=6[default=0];
427
+ required TimeInterval time_interval=7;
427
428
  }
428
429
 
429
430
  /////////////////////////////////////
430
431
  // KeySessionActivityResponse
431
432
  message KeySessionActivityResponse{
432
- optional int64 context=1;
433
- required string session_group=2;
434
- repeated SessionID sessions=3;
433
+ optional int64 context=1;
434
+ required string session_group=2;
435
+ repeated SessionID sessions=3;
435
436
  }
436
437
 
437
438
  /////////////////////////////////////
438
439
  // SessionTrackerRequest
439
440
  message SessionTrackerRequest {
440
- optional int64 context=1[default=0];
441
- optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
442
- required int64 tracker_id=3 [default=1];
443
- optional int64 maxitems=4 [default=100];
444
- required TimeInterval time_interval=5;
441
+ optional int64 context=1[default=0];
442
+ optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
443
+ required int64 tracker_id=3 [default=1];
444
+ optional int64 maxitems=4 [default=100];
445
+ required TimeInterval time_interval=5;
445
446
  }
446
447
 
447
448
  ///////////////////////////////////
448
449
  // SessionTrackerResponse
449
450
  message SessionTrackerResponse{
450
- optional int64 context=1;
451
- required string session_group=2;
452
- repeated SessionID sessions=3;
451
+ optional int64 context=1;
452
+ required string session_group=2;
453
+ repeated SessionID sessions=3;
453
454
  }
454
455
 
455
456
  ///////////////////////////////////
456
457
  // SessionGroupRequest
457
458
  message SessionGroupRequest {
458
- optional int64 context=1[default=0];
459
- optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
460
- optional int64 tracker_id=3;
461
- optional string key_filter=4;
462
- optional int64 maxitems=5 [default=100];
459
+ optional int64 context=1[default=0];
460
+ optional string session_group=2[default="{99A78737-4B41-4387-8F31-8077DB917336}"];
461
+ optional int64 tracker_id=3;
462
+ optional string key_filter=4;
463
+ optional int64 maxitems=5 [default=100];
463
464
  }
464
465
 
465
466
  //////////////////////////////////
466
467
  // SessionGroupResponse
467
468
  message SessionGroupResponse {
468
- optional int64 context=1;
469
- required string session_group=2;
470
- repeated string session_keys=3;
469
+ optional int64 context=1;
470
+ required string session_group=2;
471
+ repeated string session_keys=3;
471
472
  }
472
473
 
473
474
 
474
475
  //////////////////////////////////
475
476
  // ServerStatsRequest
476
477
  message ServerStatsRequest{
477
- required int64 param=1;
478
+ required int64 param=1;
478
479
  }
479
480
 
480
481
  //////////////////////////////////
481
482
  // ServerStatsResponse
482
483
  message ServerStatsResponse{
483
- required string instance_name=1;
484
- required int64 connections=2;
485
- required int64 uptime_seconds=3;
486
- required double cpu_usage_percent_trisul=4;
487
- required double cpu_usage_percent_total=5;
488
- required double mem_usage_trisul=6;
489
- required double mem_usage_total=7;
490
- required double mem_total=8;
491
- required int64 size_total=9;
492
- required double drop_percent_cap=11;
493
- required double drop_percent_trisul=12;
494
- required TimeInterval time_interval=13;
484
+ required string instance_name=1;
485
+ required int64 connections=2;
486
+ required int64 uptime_seconds=3;
487
+ required double cpu_usage_percent_trisul=4;
488
+ required double cpu_usage_percent_total=5;
489
+ required double mem_usage_trisul=6;
490
+ required double mem_usage_total=7;
491
+ required double mem_total=8;
492
+ required int64 size_total=9;
493
+ required double drop_percent_cap=11;
494
+ required double drop_percent_trisul=12;
495
+ required TimeInterval time_interval=13;
495
496
  }
496
497
 
497
498
  /////////////////////////////////////
498
499
  // AlertItemRequest
499
500
  message AlertItemRequest{
500
- optional int64 context=1[default=0];
501
- required string alert_group=2;
502
- repeated AlertID alert_ids=3;
501
+ optional int64 context=1[default=0];
502
+ required string alert_group=2;
503
+ repeated AlertID alert_ids=3;
503
504
  }
504
505
  ////////////////////////////////////
505
506
  // AlertItemResponse
506
507
  message AlertItemResponse{
507
- optional int64 context=1;
508
- required string alert_group=2;
509
- message Item {
510
- optional int64 sensor_id=1;
511
- required Timestamp time=2;
512
- optional string source_ip=3;
513
- optional string source_port=4;
514
- optional string destination_ip=5;
515
- optional string destination_port=6;
516
- required string sigid=7;
517
- required string classification=8;
518
- required string priority=9;
519
- required Timestamp dispatch_time=10;
520
- required string aux_message1=11;
521
- required string aux_message2=12;
522
- }
523
- repeated Item items=3;
508
+ optional int64 context=1;
509
+ required string alert_group=2;
510
+ message Item {
511
+ optional int64 sensor_id=1;
512
+ required Timestamp time=2;
513
+ optional string source_ip=3;
514
+ optional string source_port=4;
515
+ optional string destination_ip=5;
516
+ optional string destination_port=6;
517
+ required string sigid=7;
518
+ required string classification=8;
519
+ required string priority=9;
520
+ required Timestamp dispatch_time=10;
521
+ required string aux_message1=11;
522
+ required string aux_message2=12;
523
+ }
524
+ repeated Item items=3;
524
525
  }
525
526
 
526
527
  ////////////////////////////////////
527
528
  // AlertGroupQueryRequest
528
529
  message AlertGroupRequest {
529
- optional int64 context=1[default=0];
530
- required string alert_group=2;
531
- required TimeInterval time_interval=3;
532
- optional int64 maxitems=5 [default=10];
533
- optional string source_ip=6;
534
- optional string source_port=7;
535
- optional string destination_ip=8;
536
- optional string destination_port=9;
537
- optional string sigid=10;
538
- optional string classification=11;
539
- optional string priority=12;
540
- optional string aux_message1=13;
541
- optional string aux_message2=14;
530
+ optional int64 context=1[default=0];
531
+ required string alert_group=2;
532
+ required TimeInterval time_interval=3;
533
+ optional int64 maxitems=5 [default=10];
534
+ optional string source_ip=6;
535
+ optional string source_port=7;
536
+ optional string destination_ip=8;
537
+ optional string destination_port=9;
538
+ optional string sigid=10;
539
+ optional string classification=11;
540
+ optional string priority=12;
541
+ optional string aux_message1=13;
542
+ optional string aux_message2=14;
542
543
  }
543
544
 
544
545
  /////////////////////////////////////
545
546
  // AlertGroupResponse
546
547
  message AlertGroupResponse {
547
- optional int64 context=1;
548
- required string alert_group=2;
549
- repeated AlertID alerts=3;
548
+ optional int64 context=1;
549
+ required string alert_group=2;
550
+ repeated AlertID alerts=3;
550
551
  }
551
552
 
552
553
  /////////////////////////////////////
553
554
  // ResourceRequest - mutliple
554
555
  message ResourceItemRequest{
555
- optional int64 context=1[default=0];
556
- required string resource_group=2;
557
- repeated ResourceID resource_ids=3;
556
+ optional int64 context=1[default=0];
557
+ required string resource_group=2;
558
+ repeated ResourceID resource_ids=3;
558
559
  }
559
560
  ////////////////////////////////////
560
561
  // ResourceItemResponse
561
562
  message ResourceItemResponse{
562
- optional int64 context=1;
563
- required string resource_group=2;
564
- message Item {
565
- required Timestamp time=1;
566
- required ResourceID resource_id=2;
567
- optional string source_ip=3;
568
- optional string source_port=4;
569
- optional string destination_ip=5;
570
- optional string destination_port=6;
571
- optional string uri=7;
572
- optional string userlabel=8;
573
- }
574
- repeated Item items=3;
563
+ optional int64 context=1;
564
+ required string resource_group=2;
565
+ message Item {
566
+ required Timestamp time=1;
567
+ required ResourceID resource_id=2;
568
+ optional string source_ip=3;
569
+ optional string source_port=4;
570
+ optional string destination_ip=5;
571
+ optional string destination_port=6;
572
+ optional string uri=7;
573
+ optional string userlabel=8;
574
+ }
575
+ repeated Item items=3;
575
576
  }
576
577
 
577
578
  ////////////////////////////////////
578
579
  // ResourceGroupRequest
579
580
  message ResourceGroupRequest {
580
- optional int64 context=1[default=0];
581
- required string resource_group=2;
582
- required TimeInterval time_interval=3;
583
- optional int64 maxitems=4 [default=10];
584
- optional string source_ip=5;
585
- optional string source_port=6;
586
- optional string destination_ip=7;
587
- optional string destination_port=8;
588
- optional string uri_pattern=9;
589
- optional string userlabel_pattern=10;
581
+ optional int64 context=1[default=0];
582
+ required string resource_group=2;
583
+ required TimeInterval time_interval=3;
584
+ optional int64 maxitems=4 [default=10];
585
+ optional string source_ip=5;
586
+ optional string source_port=6;
587
+ optional string destination_ip=7;
588
+ optional string destination_port=8;
589
+ optional string uri_pattern=9;
590
+ optional string userlabel_pattern=10;
590
591
  }
591
592
 
592
593
  /////////////////////////////////////
593
594
  // ResourceGroupResponse
594
595
  message ResourceGroupResponse {
595
- optional int64 context=1;
596
- required string resource_group=2;
597
- repeated ResourceID resources=3;
596
+ optional int64 context=1;
597
+ required string resource_group=2;
598
+ repeated ResourceID resources=3;
598
599
  }
599
600
 
600
601
 
@@ -602,19 +603,17 @@ message ResourceGroupResponse {
602
603
  /////////////////////////////////////////////
603
604
  // KeyLookup - mutliple keys from a single CG
604
605
  message KeyLookupRequest {
605
- optional int64 context=1[default=0];
606
- required string counter_group=2;
607
- repeated string keys=3;
606
+ optional int64 context=1[default=0];
607
+ required string counter_group=2;
608
+ repeated string keys=3;
608
609
  }
609
610
 
610
611
 
611
612
  /////////////////////////////////////////////
612
613
  // KeyLookup
613
614
  message KeyLookupResponse {
614
- optional int64 context=1;
615
- required string counter_group=2;
616
- repeated KeyDetails key_details=3;
615
+ optional int64 context=1;
616
+ required string counter_group=2;
617
+ repeated KeyDetails key_details=3;
617
618
  }
618
619
 
619
-
620
-
data/test/test_key.rb ADDED
@@ -0,0 +1,27 @@
1
+ # Trisul Remote Protocol TRP Demo script
2
+ require 'rubygems'
3
+ require './helper'
4
+ include TrisulRP::Protocol
5
+ include TrisulRP::Keys
6
+
7
+ class TestTrisulrp < Test::Unit::TestCase
8
+
9
+ def test_keys
10
+ p "0A.01.3C.BB = "
11
+ p TrisulRP::Keys::make_readable( "0A.01.3C.BB" )
12
+
13
+ p "10.1.60.187 = "
14
+ p TrisulRP::Keys::make_key( "10.1.60.187" )
15
+
16
+ p "p-01BB = "
17
+ p TrisulRP::Keys::make_readable( "p-01BB" )
18
+
19
+ p "Port-443 = "
20
+ p TrisulRP::Keys::make_key( "Port-443" )
21
+
22
+ end
23
+
24
+
25
+ end
26
+
27
+
data/trisulrp.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{trisulrp}
8
- s.version = "1.2.5"
8
+ s.version = "1.2.6"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["vivek"]
@@ -50,6 +50,7 @@ Gem::Specification.new do |s|
50
50
  "test/helper.rb",
51
51
  "test/test_alerts.rb",
52
52
  "test/test_cap.rb",
53
+ "test/test_key.rb",
53
54
  "test/test_key_flows.rb",
54
55
  "test/test_resources.rb",
55
56
  "test/test_trisulrp.rb"
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 2
8
- - 5
9
- version: 1.2.5
8
+ - 6
9
+ version: 1.2.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - vivek
@@ -135,6 +135,7 @@ files:
135
135
  - test/test_resources.rb
136
136
  - test/test_trisulrp.rb
137
137
  - trisulrp.gemspec
138
+ - test/test_key.rb
138
139
  has_rdoc: true
139
140
  homepage: http://github.com/vivekrajan/trisulrp
140
141
  licenses:
@@ -149,7 +150,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
149
150
  requirements:
150
151
  - - ">="
151
152
  - !ruby/object:Gem::Version
152
- hash: 236447741
153
+ hash: -636582125
153
154
  segments:
154
155
  - 0
155
156
  version: "0"
@@ -173,6 +174,7 @@ test_files:
173
174
  - test/helper.rb
174
175
  - test/test_alerts.rb
175
176
  - test/test_cap.rb
177
+ - test/test_key.rb
176
178
  - test/test_key_flows.rb
177
179
  - test/test_resources.rb
178
180
  - test/test_trisulrp.rb