-
Notifications
You must be signed in to change notification settings - Fork 0
Packet
AS/400 protocols in general, use structured packets and usually have field-addressable data, somewhat like RIFF.
Assume all fields are unsigned unless otherwise stated. When documents ask for "-1" they usually mean the maximimum value of an unsigned type. All data is big endian.
Strings can vary wildly, either fixed-size EBCDIC padded with spaces, (0x40; which appears as @
in ASCII) big-endian UTF-16 values, or ASCII/UTF-8 strings.
In general, assume the protocol for services will be consistent with themselves, not others.
This is 20 bytes.
-
Length: A 4-byte integer. This is the length of the packet in bytes, including this field.
-
Header ID: A 2-byte integer. This field's purpose is unknown to me.
-
Server ID: A 2-byte integer. This represents what service is beinmg talked to. Even though services have their own TCP/IP ports, they could be misaddressed, and signon requires a signon service exchange over the service's port.
-
CS instance: A 4-byte integer. This field's purpose is unkknown to me.
-
Correlation ID: A 4-byte integer. This field marks "conversations" of packet strings to be identified.
-
Template length: A 2-byte integer. This is the amount of bytes until field-addressable data can be accessed. Information in the "teplate" area is generally accessed directly by offset, not with an "LLCP."
-
Request/Response ID: A 2-byte integer. This is the ID of the packet type for a service.
Fields start after the header plus the template length. They're addressed by "LLCPs" - a 6-byte header identifying chunks. To know where they are, you read the first LLCP and keep addressing based on the next LLCP at the end of the current one until you reach the end of the stream.
An LLCP consists of:
-
A 4-byte integer for length.
-
A 2-byte integer for field ID, or "code point."