summaryrefslogtreecommitdiff
path: root/broccoli/script
diff options
context:
space:
mode:
authorRobert Gustafsson <robg@student.chalmers.se>2017-10-03 09:14:55 +0200
committerAndreas Lindhé <andreas@lindhe.io>2017-10-09 12:14:35 +0200
commitf4a7033d3629976f9980cb956e2c29315c6306c0 (patch)
tree9ef8d5193944f5b0f5e4f0f404cfcbd99cbeef43 /broccoli/script
parent1df374c02ae16e364cfa9bfab2aa4e7f8e52005e (diff)
downloadmidbro-f4a7033d3629976f9980cb956e2c29315c6306c0.tar.gz
midbro-f4a7033d3629976f9980cb956e2c29315c6306c0.tar.bz2
Some refactoring
Diffstat (limited to 'broccoli/script')
-rw-r--r--broccoli/script/modbus.bro26
1 files changed, 26 insertions, 0 deletions
diff --git a/broccoli/script/modbus.bro b/broccoli/script/modbus.bro
new file mode 100644
index 0000000..a2caed9
--- /dev/null
+++ b/broccoli/script/modbus.bro
@@ -0,0 +1,26 @@
+@load frameworks/communication/listen
+module Pasad;
+
+redef Communication::listen_port = 47760/tcp;
+
+redef Communication::listen_ssl = F;
+
+global response: event(register: count, uid: count);
+
+redef Communication::nodes += {
+ ["broevent"] = [$host = 127.0.0.1, $events = /broevent/, $connect=F, $ssl=F]
+};
+
+event modbus_read_holding_registers_request(c: connection, headers: ModbusHeaders, start_adress: count, quantity: count)
+
+{
+ print fmt("Request: %d", quantity);
+}
+
+event modbus_read_holding_registers_response(c: connection, headers: ModbusHeaders, registers: ModbusRegisters)
+
+{
+ print fmt("Response: %d", registers[0]);
+ event response(registers[0],headers$uid);
+}
+