trisulrp 3.1.1 → 3.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5c2e757a7bc1175c201b874b019355dcc7767195
4
- data.tar.gz: 726025203f6357c6d9534a3fcacd96323681a3d8
3
+ metadata.gz: d746529a58169ecd21dfc22df6da7df45ff2fec6
4
+ data.tar.gz: 37da2b8faabed36ecba2b3abd13225b96337efa6
5
5
  SHA512:
6
- metadata.gz: 879228c4ceffd86ea132bed1c2262351d6d40a373d992761a272ceecee97df0ba32286a66b8e2a951203365dd2a6ddbe3250a37aa464aa320f387345ab5dae7d
7
- data.tar.gz: 47ae512ff07dda3f2af5e1db5296f611c4700bdea578150e4596ae70b9b3c282bf661bde4a63933e186040f57870f60b0b6b43b8cfdfb1485159a7c5137ef718
6
+ metadata.gz: 3660641d24970edef7fcd9107e75b114ef3d2c0c1ae1f648929a450ae1d26f6641887c41b6318b19cf6d6de49187ce599a6399d7b77c39bf099f93a9c525f112
7
+ data.tar.gz: 3904ccf3b5ed2d2dce3d75a6f7c56b907561298e953656498c3370f86b9bba77cccb415044440e61864d061e6cf631daa87a54fb6d6cfa64620a6e5f8cee4d0d
data/VERSION CHANGED
@@ -1 +1 @@
1
- 3.1.1
1
+ 3.1.7
@@ -196,6 +196,47 @@ module TrisulRP::Protocol
196
196
 
197
197
  end
198
198
 
199
+ # returns response str
200
+ def get_response_zmq_raw(endpoint, trp_request_buf , timeout_seconds = -1 )
201
+
202
+
203
+ ctx=ZMQ::Context.new
204
+ sock = ctx.socket(ZMQ::REQ)
205
+
206
+ # time out for context termination
207
+ sock.setsockopt(ZMQ::LINGER, 5*1_000)
208
+
209
+ # Initialize a poll set
210
+ poller = ZMQ::Poller.new
211
+ poller.register(sock, ZMQ::POLLIN)
212
+
213
+ sock.connect(endpoint)
214
+ sock.send_string(trp_request_buf)
215
+
216
+ ret = poller.poll(timeout_seconds * 1_000 )
217
+ if ret == -1
218
+ sock.close
219
+ ctx.terminate
220
+ raise "zeromq poll error #{endpoint} "
221
+ end
222
+ if ret == 0
223
+ sock.close
224
+ ctx.terminate
225
+ raise "no registerted sockets #{endpoint} "
226
+ end
227
+
228
+ poller.readables.each do |rsock|
229
+
230
+ #in
231
+ dataarray=""
232
+ rsock.recv_string(dataarray)
233
+ rsock.close
234
+ ctx.terminate
235
+ return dataarray
236
+ end
237
+
238
+ end
239
+
199
240
 
200
241
 
201
242
  # Query the total time window available in Trisul
@@ -275,24 +316,27 @@ module TrisulRP::Protocol
275
316
  end
276
317
 
277
318
  params.each do |k,v|
278
- f = msg.get_field(k)
279
- if v.is_a? String
280
- if f.is_a? Protobuf::Field::MessageField and f.type_class.to_s == "TRP::KeyT"
281
- params[k] = TRP::KeyT.new( :label => v )
282
- elsif f.is_a? Protobuf::Field::Int64Field
283
- params[k] = v.to_i
284
- elsif f.is_a? Protobuf::Field::StringField and f.rule == :repeated
285
- params[k] = v.split(',')
286
- elsif f.is_a? Protobuf::Field::BoolField
287
- params[k] = ( v == "true")
288
- end
289
- elsif v.is_a? BigDecimal or v.is_a? Float
290
- if f.is_a? Protobuf::Field::Int64Field
291
- params[k] = v.to_i
292
- end
293
- end
294
-
295
- end
319
+ f = msg.get_field(k)
320
+ if v.is_a? String
321
+ if f.is_a? Protobuf::Field::MessageField and f.type_class.to_s == "TRP::KeyT"
322
+ params[k] = TRP::KeyT.new( :label => v )
323
+ elsif f.is_a? Protobuf::Field::Int64Field
324
+ params[k] = v.to_i
325
+ elsif f.is_a? Protobuf::Field::StringField and f.rule == :repeated
326
+ params[k] = v.split(',')
327
+ elsif f.is_a? Protobuf::Field::BoolField
328
+ params[k] = ( v == "true")
329
+ end
330
+ elsif v.is_a? BigDecimal or v.is_a? Float
331
+ if f.is_a? Protobuf::Field::Int64Field
332
+ params[k] = v.to_i
333
+ end
334
+ elsif v.is_a?Array and f.is_a?Protobuf::Field::MessageField and f.type_class.to_s == "TRP::KeyT"
335
+ v.each_with_index do |v1,idx|
336
+ v[idx]= TRP::KeyT.new( :label => v1 ) if v1.is_a?String
337
+ end
338
+ end
339
+ end
296
340
 
297
341
  end
298
342
 
@@ -335,13 +379,13 @@ module TrisulRP::Protocol
335
379
  params =in_params.dup
336
380
  opts = {:trp_command=> cmd_id}
337
381
  if params.has_key?(:destination_node)
338
- opts[:destination_node] = params.delete(:destination_node)
382
+ opts[:destination_node] = params[:destination_node]
339
383
  end
340
384
  if params.has_key?(:probe_id)
341
- opts[:probe_id] = params.delete(:probe_id)
385
+ opts[:probe_id] = params[:probe_id]
342
386
  end
343
387
  if params.has_key?(:run_async)
344
- opts[:run_async] = params.delete(:run_async)
388
+ opts[:run_async] = params[:run_async]
345
389
  end
346
390
  req = TRP::Message.new(opts)
347
391
  case cmd_id
@@ -432,6 +476,9 @@ module TrisulRP::Protocol
432
476
  when TRP::Message::Command::NODE_CONFIG_REQUEST
433
477
  fix_TRP_Fields( TRP::NodeConfigRequest, params)
434
478
  req.node_config_request = TRP::NodeConfigRequest.new(params)
479
+ when TRP::Message::Command::FILE_REQUEST
480
+ fix_TRP_Fields( TRP::FileRequest, params)
481
+ req.file_request = TRP::FileRequest.new(params)
435
482
  else
436
483
  raise "Unknown TRP command ID"
437
484
  end
@@ -525,6 +572,8 @@ module TrisulRP::Protocol
525
572
  resp.node_config_response
526
573
  when TRP::Message::Command::ASYNC_RESPONSE
527
574
  resp.async_response
575
+ when TRP::Message::Command::FILE_RESPONSE
576
+ resp.file_response
528
577
  else
529
578
 
530
579
  raise "#{resp.trp_commandi.to_i} Unknown TRP command ID"
@@ -464,6 +464,7 @@ module TRP
464
464
  required :string, :station_id, 1
465
465
  optional :string, :station_id_request, 2
466
466
  optional :string, :message, 3
467
+ optional :int64, :local_timestamp, 4
467
468
  end
468
469
 
469
470
  class ErrorResponse
@@ -790,6 +791,8 @@ module TRP
790
791
  optional :string, :message, 1
791
792
  optional ::TRP::NodeConfigRequest::IntelFeed, :add_feed, 2
792
793
  optional ::TRP::NodeConfigRequest::IntelFeed, :process_new_feed, 3
794
+ optional :bool, :get_all_nodes, 4, :default => true
795
+ repeated ::TRP::NameValue, :query_config, 5
793
796
  end
794
797
 
795
798
  class NodeConfigResponse
@@ -804,6 +807,7 @@ module TRP
804
807
  repeated ::TRP::NodeConfigResponse::Node, :hubs, 2
805
808
  repeated ::TRP::NodeConfigResponse::Node, :probes, 3
806
809
  repeated :string, :feeds, 4
810
+ repeated ::TRP::NameValue, :config_values, 5
807
811
  end
808
812
 
809
813
  class ContextCreateRequest
@@ -857,7 +861,7 @@ module TRP
857
861
  optional :string, :profile, 2
858
862
  optional :string, :params, 3
859
863
  optional :bytes, :push_config_blob, 4
860
- optional :string, :query_config, 5
864
+ repeated ::TRP::NameValue, :query_config, 5
861
865
  repeated ::TRP::NameValue, :set_config_values, 6
862
866
  end
863
867
 
@@ -876,7 +880,7 @@ module TRP
876
880
  repeated :string, :endpoints_flush, 6
877
881
  repeated :string, :endpoints_query, 7
878
882
  repeated :string, :endpoints_pub, 8
879
- optional :string, :config_value, 10
883
+ repeated ::TRP::NameValue, :config_values, 10
880
884
  repeated ::TRP::ContextConfigResponse::Layer, :layers, 11
881
885
  end
882
886
 
@@ -884,9 +888,11 @@ module TRP
884
888
  required :string, :context_name, 1
885
889
  optional :int64, :max_bytes, 2, :default => 100000000
886
890
  optional ::TRP::CompressionType, :compress_type, 3, :default => ::TRP::CompressionType::UNCOMPRESSED
887
- optional :string, :save_file, 4
888
- required ::TRP::TimeInterval, :time_interval, 5
889
- required :string, :filter_expression, 6
891
+ optional ::TRP::TimeInterval, :time_interval, 4
892
+ optional :string, :save_file_prefix, 5
893
+ optional :string, :filter_expression, 6
894
+ repeated :string, :merge_pcap_files, 7
895
+ optional :bool, :delete_after_merge, 8, :default => true
890
896
  end
891
897
 
892
898
  class PcapResponse
@@ -916,6 +922,7 @@ module TRP
916
922
  required :string, :context_name, 1
917
923
  repeated ::TRP::SessionT, :sessions, 2
918
924
  repeated :string, :hints, 3
925
+ optional :string, :probe_id, 4
919
926
  end
920
927
 
921
928
  class ProbeStatsRequest
@@ -956,6 +963,8 @@ module TRP
956
963
  required :string, :uri, 1
957
964
  required :int64, :position, 2
958
965
  optional :string, :params, 3
966
+ optional :string, :context_name, 4
967
+ optional :bool, :delete_on_eof, 5, :default => false
959
968
  end
960
969
 
961
970
  class FileResponse
@@ -964,6 +973,7 @@ module TRP
964
973
  optional :int64, :position, 3
965
974
  optional :bytes, :content, 4
966
975
  optional :string, :request_params, 5
976
+ optional :string, :context_name, 6
967
977
  end
968
978
 
969
979
  end
@@ -373,6 +373,7 @@ message HelloResponse{
373
373
  required string station_id=1;
374
374
  optional string station_id_request=2;
375
375
  optional string message=3;
376
+ optional int64 local_timestamp=4;
376
377
  }
377
378
 
378
379
  ///////////////////////////////
@@ -812,8 +813,11 @@ message NodeConfigRequest {
812
813
  repeated string uri=4; // individual files in config//.. for FileRequest download
813
814
  }
814
815
 
815
- optional IntelFeed add_feed=2;
816
- optional IntelFeed process_new_feed=3;
816
+ optional IntelFeed add_feed=2;
817
+ optional IntelFeed process_new_feed=3;
818
+ optional bool get_all_nodes=4[default=true];
819
+ repeated NameValue query_config=5;
820
+
817
821
  }
818
822
 
819
823
  message NodeConfigResponse {
@@ -825,10 +829,11 @@ message NodeConfigResponse {
825
829
  required string public_key=4;
826
830
  }
827
831
 
828
- repeated Node domains=1;
829
- repeated Node hubs=2;
830
- repeated Node probes=3;
831
- repeated string feeds=4;
832
+ repeated Node domains=1;
833
+ repeated Node hubs=2;
834
+ repeated Node probes=3;
835
+ repeated string feeds=4;
836
+ repeated NameValue config_values=5;
832
837
  }
833
838
 
834
839
 
@@ -905,8 +910,7 @@ message ContextConfigRequest {
905
910
  optional string profile=2;
906
911
  optional string params=3;
907
912
  optional bytes push_config_blob=4; // push this ..
908
- optional string query_config=5; // push this ..
909
-
913
+ repeated NameValue query_config=5; // query, leave the .value field blank
910
914
  repeated NameValue set_config_values=6; // push this .. (name=value;name=value ..)
911
915
  }
912
916
 
@@ -928,7 +932,7 @@ message ContextConfigResponse {
928
932
  repeated string endpoints_flush=6;
929
933
  repeated string endpoints_query=7;
930
934
  repeated string endpoints_pub=8;
931
- optional string config_value=10; // response to query config ..
935
+ repeated NameValue config_values=10; // query, leave the .value field blank
932
936
  repeated Layer layers=11;
933
937
 
934
938
  }
@@ -937,16 +941,24 @@ message ContextConfigResponse {
937
941
  // PcapReqiest
938
942
  // NOTE - only one of the various filters are supported
939
943
  // sending > 1 will result in error
944
+ //
945
+ // Modes
946
+ // 1. nothing set => PCAP file in contents
947
+ // 2. save_file_prefix set => file download token
948
+ // 3. merge_pcap_files => file download token
940
949
  //
941
950
  message PcapRequest {
942
951
  required string context_name=1;
943
952
  optional int64 max_bytes=2[default=100000000]; // 100MB , can increase to 0.75 Filesystem freespace
944
953
  optional CompressionType compress_type=3[default=UNCOMPRESSED];
945
- optional string save_file=4;
946
- required TimeInterval time_interval=5;
947
- required string filter_expression=6;
954
+ optional TimeInterval time_interval=4; // not needed for merge option
955
+ optional string save_file_prefix=5;
956
+ optional string filter_expression=6;
957
+ repeated string merge_pcap_files=7;
958
+ optional bool delete_after_merge=8[default=true];
948
959
  }
949
960
 
961
+
950
962
  /////////////////////////////////////
951
963
  // FileredDatagaramResponse
952
964
  message PcapResponse {
@@ -957,7 +969,7 @@ message PcapResponse {
957
969
  optional int64 num_bytes=5;
958
970
  optional string sha1=6;
959
971
  optional bytes contents=7;
960
- optional string save_file=8;
972
+ optional string save_file=8; //use FileRequest framework to download
961
973
  }
962
974
 
963
975
  ////////////////////////////////////
@@ -980,6 +992,7 @@ message GrepResponse {
980
992
  required string context_name=1;
981
993
  repeated SessionT sessions=2;
982
994
  repeated string hints=3;
995
+ optional string probe_id=4;
983
996
  }
984
997
 
985
998
  //////////////////////////////////
@@ -1031,6 +1044,8 @@ message FileRequest {
1031
1044
  required string uri=1;
1032
1045
  required int64 position=2;
1033
1046
  optional string params=3; // local meaning sentback n response
1047
+ optional string context_name=4;
1048
+ optional bool delete_on_eof=5[default=false];
1034
1049
  }
1035
1050
 
1036
1051
  //////////////////////////////////
@@ -1043,6 +1058,7 @@ message FileResponse {
1043
1058
  optional int64 position=3;
1044
1059
  optional bytes content=4;
1045
1060
  optional string request_params =5;
1061
+ optional string context_name=6;
1046
1062
  }
1047
1063
 
1048
1064
 
data/lib/trisulrp.rb CHANGED
@@ -10,6 +10,10 @@ module TrisulRP
10
10
  end
11
11
 
12
12
  require 'rubygems'
13
+
14
+ require 'protobuf'
15
+ ::Protobuf.ignore_unknown_fields=true
16
+
13
17
  require 'trisulrp/trp.pb'
14
18
  require 'trisulrp/guids.rb'
15
19
  require 'trisulrp/keys.rb'
data/trisulrp.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: trisulrp 3.1.1 ruby lib
5
+ # stub: trisulrp 3.1.7 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "trisulrp"
9
- s.version = "3.1.1"
9
+ s.version = "3.1.7"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["vivek"]
14
- s.date = "2016-08-02"
14
+ s.date = "2016-08-25"
15
15
  s.description = "This gem deals about the trisul remote protocol"
16
16
  s.email = "vivek_rajagopal@yahoo.com"
17
17
  s.extra_rdoc_files = [
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: trisulrp
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - vivek
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-02 00:00:00.000000000 Z
11
+ date: 2016-08-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: protobuf