Skip to content

Commit

Permalink
Support directory syntax & functionality (#1323)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitk-me authored Nov 17, 2024
1 parent 21c4ea2 commit 68ce04e
Show file tree
Hide file tree
Showing 108 changed files with 1,607 additions and 329 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ 17, 21, 22 ]
java: [ 20, 21, 22 ]

steps:
- name: Checkout GitHub sources
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup JDK 17
- name: Setup JDK 20
uses: actions/setup-java@v4
with:
distribution: zulu
java-version: 17
java-version: 20

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -408,12 +408,26 @@ local fields = {

-- filesystem extension
filesystem_ext_capabilities = ProtoField.uint32("zilla.filesystem_ext.capabilities", "Capabilities", base.HEX),
filesystem_ext_capabilities_read_payload = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_payload",
"READ_PAYLOAD", base.DEC, flags_types, 0x01),
filesystem_ext_capabilities_read_extension = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_extension",
"READ_EXTENSION", base.DEC, flags_types, 0x02),
filesystem_ext_capabilities_read_changes = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_changes",
"READ_CHANGES", base.DEC, flags_types, 0x04),
filesystem_ext_capabilities_create_directory = ProtoField.uint32("zilla.filesystem_ext.capabilities_create_directory",
"CREATE_DIRECTORY", base.DEC, flags_types, 0x01),
filesystem_ext_capabilities_create_file = ProtoField.uint32("zilla.filesystem_ext.capabilities_create_file",
"CREATE_FILE", base.DEC, flags_types, 0x02),
filesystem_ext_capabilities_delete_directory = ProtoField.uint32("zilla.filesystem_ext.capabilities_delete_directory",
"DELETE_DIRECTORY", base.DEC, flags_types, 0x04),
filesystem_ext_capabilities_delete_file = ProtoField.uint32("zilla.filesystem_ext.capabilities_delete_file",
"DELETE_FILE", base.DEC, flags_types, 0x08),
filesystem_ext_capabilities_read_directory = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_directory",
"READ_DIRECTORY", base.DEC, flags_types, 0x10),
filesystem_ext_capabilities_read_file = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_file",
"READ_FILE", base.DEC, flags_types, 0x20),
filesystem_ext_capabilities_read_file_changes = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_file_changes",
"READ_FILE_CHANGES", base.DEC, flags_types, 0x40),
filesystem_ext_capabilities_read_metadata = ProtoField.uint32("zilla.filesystem_ext.capabilities_read_metadata",
"READ_METADATA", base.DEC, flags_types, 0x80),
filesystem_ext_capabilities_write_file = ProtoField.uint32("zilla.filesystem_ext.capabilities_write_file",
"WRITE_FILE", base.DEC, flags_types, 0x100),
filesystem_ext_directory_length = ProtoField.int16("zilla.filesystem_ext.directory_length", "Length", base.DEC),
filesystem_ext_directory = ProtoField.string("zilla.filesystem_ext.directory", "Directory", base.NONE),
filesystem_ext_path_length = ProtoField.int16("zilla.filesystem_ext.path_length", "Length", base.DEC),
filesystem_ext_path = ProtoField.string("zilla.filesystem_ext.path", "Path", base.NONE),
filesystem_ext_type_length = ProtoField.int16("zilla.filesystem_ext.type_length", "Length", base.DEC),
Expand Down Expand Up @@ -1563,11 +1577,22 @@ function handle_filesystem_extension(buffer, offset, ext_subtree)
local slice_capabilities = buffer(capabilities_offset, capabilities_length)
local capabilities_label = string.format("Capabilities: 0x%08x", slice_capabilities:le_uint())
local capabilities_subtree = ext_subtree:add(zilla_protocol, slice_capabilities, capabilities_label)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_payload, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_extension, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_changes, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_create_directory, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_create_file, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_delete_directory, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_delete_file, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_directory, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_file, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_file_changes, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_read_metadata, slice_capabilities)
capabilities_subtree:add_le(fields.filesystem_ext_capabilities_write_file, slice_capabilities)
-- directory
local directory_offset = capabilities_offset + capabilities_length
local directory_length, slice_directory_length, slice_directory_text = dissect_length_value(buffer, directory_offset, 2)
add_string_as_subtree(buffer(directory_offset, directory_length), ext_subtree, "Directory: %s",
slice_directory_length, slice_directory_text, fields.filesystem_ext_directory_length, fields.filesystem_ext_directory)
-- path
local path_offset = capabilities_offset + capabilities_length
local path_offset = directory_offset + directory_length
local path_length, slice_path_length, slice_path_text = dissect_length_value(buffer, path_offset, 2)
add_string_as_subtree(buffer(path_offset, path_length), ext_subtree, "Path: %s",
slice_path_length, slice_path_text, fields.filesystem_ext_path_length, fields.filesystem_ext_path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ connect "zilla://streams/app0"

write zilla:begin.ext ${filesystem:beginEx()
.typeId(zilla:id("filesystem"))
.capabilities("READ_EXTENSION")
.capabilities("READ_METADATA")
.path("index.html")
.payloadSize(0)
.build()}
connected

write close

read zilla:begin.ext ${filesystem:matchBeginEx()
.typeId(zilla:id("filesystem"))
.capabilities("READ_EXTENSION")
.capabilities("READ_METADATA")
.path("index.html")
.type("text/html")
.payloadSize(77)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@ accepted

read zilla:begin.ext ${filesystem:matchBeginEx()
.typeId(zilla:id("filesystem"))
.capabilities("READ_EXTENSION")
.capabilities("READ_METADATA")
.path("index.html")
.payloadSize(0)
.build()}
connected

read closed

write zilla:begin.ext ${filesystem:beginEx()
.typeId(zilla:id("filesystem"))
.capabilities("READ_EXTENSION")
.capabilities("READ_METADATA")
.path("index.html")
.type("text/html")
.payloadSize(77)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Frame 1: 250 bytes on wire (2000 bits), 250 bytes captured (2000 bits)
Frame 1: 252 bytes on wire (2016 bits), 252 bytes captured (2016 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:2, Dst: fe80::3f3f:0:0:3
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 0, Ack: 1, Len: 176
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 0, Ack: 1, Len: 178
Zilla Frame
Frame Type ID: 0x00000001
Frame Type: BEGIN
Expand Down Expand Up @@ -29,10 +29,19 @@ Zilla Frame
Extension: filesystem
Stream Type ID: 0x9eaae6e4
Stream Type: filesystem
Capabilities: 0x00000002
.... .... .... .... .... .... .... ...0 = READ_PAYLOAD: Not set (0)
.... .... .... .... .... .... .... ..1. = READ_EXTENSION: Set (1)
.... .... .... .... .... .... .... .0.. = READ_CHANGES: Not set (0)
Capabilities: 0x00000080
.... .... .... .... .... .... .... ...0 = CREATE_DIRECTORY: Not set (0)
.... .... .... .... .... .... .... ..0. = CREATE_FILE: Not set (0)
.... .... .... .... .... .... .... .0.. = DELETE_DIRECTORY: Not set (0)
.... .... .... .... .... .... .... 0... = DELETE_FILE: Not set (0)
.... .... .... .... .... .... ...0 .... = READ_DIRECTORY: Not set (0)
.... .... .... .... .... .... ..0. .... = READ_FILE: Not set (0)
.... .... .... .... .... .... .0.. .... = READ_FILE_CHANGES: Not set (0)
.... .... .... .... .... .... 1... .... = READ_METADATA: Set (1)
.... .... .... .... .... ...0 .... .... = WRITE_FILE: Not set (0)
Directory:
Length: -1
Directory:
Path: index.html
Length: 10
Path: index.html
Expand All @@ -48,7 +57,7 @@ Zilla Frame
Frame 2: 211 bytes on wire (1688 bits), 211 bytes captured (1688 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:2, Dst: fe80::3f3f:0:0:3
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 176, Ack: 1, Len: 137
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 178, Ack: 1, Len: 137
Zilla Frame
Frame Type ID: 0x40000002
Frame Type: WINDOW
Expand Down Expand Up @@ -82,7 +91,7 @@ Zilla Frame
Frame 3: 194 bytes on wire (1552 bits), 194 bytes captured (1552 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:2, Dst: fe80::3f3f:0:0:3
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 313, Ack: 1, Len: 120
Transmission Control Protocol, Src Port: 0, Dst Port: 7114, Seq: 315, Ack: 1, Len: 120
Zilla Frame
Frame Type ID: 0x00000003
Frame Type: END
Expand All @@ -107,10 +116,10 @@ Zilla Frame
Trace ID: 0x8000000000000003
Authorization: 0x0000000000000000

Frame 4: 259 bytes on wire (2072 bits), 259 bytes captured (2072 bits)
Frame 4: 261 bytes on wire (2088 bits), 261 bytes captured (2088 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:3, Dst: fe80::3f3f:0:0:2
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 1, Ack: 433, Len: 185
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 1, Ack: 435, Len: 187
Zilla Frame
Frame Type ID: 0x00000001
Frame Type: BEGIN
Expand Down Expand Up @@ -138,10 +147,19 @@ Zilla Frame
Extension: filesystem
Stream Type ID: 0x9eaae6e4
Stream Type: filesystem
Capabilities: 0x00000002
.... .... .... .... .... .... .... ...0 = READ_PAYLOAD: Not set (0)
.... .... .... .... .... .... .... ..1. = READ_EXTENSION: Set (1)
.... .... .... .... .... .... .... .0.. = READ_CHANGES: Not set (0)
Capabilities: 0x00000080
.... .... .... .... .... .... .... ...0 = CREATE_DIRECTORY: Not set (0)
.... .... .... .... .... .... .... ..0. = CREATE_FILE: Not set (0)
.... .... .... .... .... .... .... .0.. = DELETE_DIRECTORY: Not set (0)
.... .... .... .... .... .... .... 0... = DELETE_FILE: Not set (0)
.... .... .... .... .... .... ...0 .... = READ_DIRECTORY: Not set (0)
.... .... .... .... .... .... ..0. .... = READ_FILE: Not set (0)
.... .... .... .... .... .... .0.. .... = READ_FILE_CHANGES: Not set (0)
.... .... .... .... .... .... 1... .... = READ_METADATA: Set (1)
.... .... .... .... .... ...0 .... .... = WRITE_FILE: Not set (0)
Directory:
Length: -1
Directory:
Path: index.html
Length: 10
Path: index.html
Expand All @@ -157,7 +175,7 @@ Zilla Frame
Frame 5: 194 bytes on wire (1552 bits), 194 bytes captured (1552 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:3, Dst: fe80::3f3f:0:0:2
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 186, Ack: 433, Len: 120
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 188, Ack: 435, Len: 120
Zilla Frame
Frame Type ID: 0x00000003
Frame Type: END
Expand Down Expand Up @@ -185,7 +203,7 @@ Zilla Frame
Frame 6: 211 bytes on wire (1688 bits), 211 bytes captured (1688 bits)
Ethernet II, Src: Send_00 (20:53:45:4e:44:00), Dst: Receive_00 (20:52:45:43:56:00)
Internet Protocol Version 6, Src: fe80::3f3f:0:0:3, Dst: fe80::3f3f:0:0:2
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 306, Ack: 433, Len: 137
Transmission Control Protocol, Src Port: 7114, Dst Port: 0, Seq: 308, Ack: 435, Len: 137
Zilla Frame
Frame Type ID: 0x40000002
Frame Type: WINDOW
Expand Down
10 changes: 5 additions & 5 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>20</maven.compiler.source>
<maven.compiler.target>20</maven.compiler.target>
<maven.compiler.release>20</maven.compiler.release>
<checkstyle.config.location>io/aklivity/zilla/conf/checkstyle/configuration.xml</checkstyle.config.location>
<checkstyle.suppressions.location>io/aklivity/zilla/conf/checkstyle/suppressions.xml</checkstyle.suppressions.location>
<antlr4.version>4.13.0</antlr4.version>
Expand Down Expand Up @@ -392,7 +392,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.5.0</version>
<version>3.6.0</version>
<executions>
<execution>
<phase>package</phase>
Expand Down Expand Up @@ -699,7 +699,7 @@
<message>No Snapshots Allowed!</message>
</requireReleaseDeps>
<requireJavaVersion>
<version>[17,18)</version>
<version>[21,22)</version>
</requireJavaVersion>
<requireProperty>
<property>release</property>
Expand Down
Loading

0 comments on commit 68ce04e

Please sign in to comment.