Protocol: MESSAGE-v1.asn1
Packets: Message, Authority, Ack
Versions: v1
Sokhatsky Messenger Protocol v1
Formal definition to talk with beings over Wi-Fi network.
Contents
- Actors
1.1) Announcement Authority Looper
1.2) Send Looper
1.3) Receive Looper
1.4) Network Looper
1.5) Expiration Event
- Packets
2.1) Announcement
2.2) Message
2.3) Acknowledgement
- Notes
3.1) Announcement Looper
3.2) Send Looper
3.3) Receive Looper
3.4) Network Looper
- Specification
1. Actors
The Node Architecture of Distributed Protocol Consists of 4 Actors:
1.1. Announce Authority Looper
The Announce Looper starts On Application Load and introduce itself by sending 5 consequent message each 10 seconds.
This message contains X.509 instance certificate obtained from local CA.
1.2. Send Looper
The Send Looper starts On Application Load and introduce worker that handles Sending Queue and process each message to send by sending its 5 consequent copies each 10 seconds. If Message is Acknowledgement then it should be removed from Sending Queue if recipient has not been seen in network for more that 1 minute (last_seen field or Participant) and respawn Ack sending on this recipient either when it became online (last_seen field changed or chat window just opened) or the conversation chat window with this recipient is being opened.
1.3. Receive Looper
The Receive Looper starts On Application Load and introduce worker that handles Receive Queue and process each message by calling event handler for each messaged added to Receive Queue from Network Looper. Receive Looper handles Three types of messages:
- On
Authority -> Add Air Observed Digital Identity from X.509 Certificate to Roster.
- On
Message -> Add Message to Chat Conversation, Add derived Acknowledgement to Sending Queue.
- On
Ack -> Remove Message packet from Sending Queue.
- On
Expiration -> Restart 3 Loopers (Receive, Send, Announce)
1.4. Network Looper
The Network Looper receive from UDP system calls packets and adds them to Receive Queue.
1.5. Expiration Event
On Expiration Event when the X.509 Digital Identity Certificate expiration happens the 3 loopers originated by application must respawn Send Looper, Receive Looper and Announce Looper.
2. Packets
The Sokhatsky Messenger Protocol Defines 3 Message UDP Packets for Multicast Talk:
2.1. Authority Announcement
On Application Load each instance introduce its keys obtained from CA (built-in in-host) by sending 5 messages of Authority each 10 seconds.
struct Authority {
id: Int
vsn: Int = 1
ip: [UInt8]
topic: Int = 1
cert: Certificate
}
2.2. Message
On Message Send application adds this message to Sending Queue.
struct Message {
id: Int
vsn: Int = 1
ip: [UInt8]
to: [UInt8] // Beneficiary
topic: Int = 28
cms: EnvelopedData
}
2.3. Ack
On Message Receive application adds this message to Sending Queue.
struct Ack {
id: Int
vsn: Int = 1
ip: [UInt8]
to: [UInt8]
topic: Int = 28
payload: Int // Message.id
}
3. Notes
3.1. Authority Looper
- Starts automatically when application launches
- Purpose: periodically announce own digital identity to local network
- Behavior: every 10 seconds sends 5 identical Announcement packets in a row
- Content: current own X.509 certificate issued by local (in-host / embedded) CA
3.2. Send Looper
- Starts automatically when application launches
- Purpose: reliable delivery of outgoing messages & acknowledgements
- Behavior: takes messages from Sending Queue and for each item:
→ sends 5 identical copies with 10 seconds interval between bursts
→ both Message and Acknowledgement packets are handled the same way
3.3. Receive Looper
- Starts automatically when application launches
- Purpose: processing of all incoming packets
- Takes packets from Receive Queue (filled by Network Looper)
- Handles three kinds of packets differently:
Type Action
───────────────────────────────────────
Authority → Extract identity (certificate)
→ Add/update sender in local **Roster** (observed identities)
Message → Decrypt/verify CMS → EnvelopedData
→ Display message in corresponding conversation
→ Create corresponding Acknowledgement
→ Put Acknowledgement into **Sending Queue**
Expiration → Restart **Send Looper**
→ Restart **Receive Looper**
→ Restart **Announce Looper**
Ack → Find original Message in **Sending Queue** by id
→ Remove that message from Sending Queue (stop retransmissions)
4. Network Looper
- Lowest level I/O loop
- Purpose: pure network receive & minimal pre-processing
- Continuously listens on UDP multicast/broadcast socket
- On every received datagram:
→ very basic validation (minimal size, version field)
→ puts raw packet into Receive Queue for further processing
Specification
Sokhatsky Messenger Protocol v1 is defined in MESSAGE.asn1 file.
MESSAGE DEFINITIONS ::= BEGIN
Authority ::= SEQUENCE {
id INTEGER, -- unique message identifier (usually monotonic)
version INTEGER DEFAULT 1, -- protocol version
source OCTET STRING (SIZE(4)),-- IPv4 address of sender (big-endian)
topic INTEGER DEFAULT 1 -- chat room / channel identifier
certificate Certificate -- X.509 certificate of the announcing node
}
Message ::= SEQUENCE {
id INTEGER, -- unique message identifier (usually monotonic)
version INTEGER DEFAULT 1, -- protocol version
source OCTET STRING (SIZE(4)),-- IPv4 address of sender (big-endian)
topic INTEGER DEFAULT 1 -- chat room / channel identifier
recipient OCTET STRING (SIZE(4)) OPTIONAL, -- IPv4 of direct recipient (if known)
content ContentInfo -- CMS EnvelopedData (usually with 1 recipient = group key)
}
Ack ::= SEQUENCE {
id INTEGER, -- unique message identifier (usually monotonic)
version INTEGER DEFAULT 1, -- protocol version
source OCTET STRING (SIZE(4)),-- IPv4 address of sender (big-endian)
topic INTEGER DEFAULT 1 -- chat room / channel identifier
recipient OCTET STRING (SIZE(4)) OPTIONAL,
ackFor INTEGER -- id of the Message we are acknowledging
}
END
Protocol:
MESSAGE-v1.asn1Packets:
Message,Authority,AckVersions:
v1Sokhatsky Messenger Protocol v1
Formal definition to talk with beings over Wi-Fi network.
Contents
1.1) Announcement Authority Looper
1.2) Send Looper
1.3) Receive Looper
1.4) Network Looper
1.5) Expiration Event
2.1) Announcement
2.2) Message
2.3) Acknowledgement
3.1) Announcement Looper
3.2) Send Looper
3.3) Receive Looper
3.4) Network Looper
1. Actors
The Node Architecture of Distributed Protocol Consists of 4 Actors:
1.1. Announce Authority Looper
The
Announce Looperstarts On Application Load and introduce itself by sending 5 consequent message each 10 seconds.This message contains X.509 instance certificate obtained from local CA.
1.2. Send Looper
The
Send Looperstarts On Application Load and introduce worker that handlesSending Queueand process each message to send by sending its 5 consequent copies each 10 seconds. If Message isAcknowledgementthen it should be removed fromSending Queueif recipient has not been seen in network for more that 1 minute (last_seen field or Participant) and respawn Ack sending on this recipient either when it became online (last_seen field changed or chat window just opened) or the conversation chat window with this recipient is being opened.1.3. Receive Looper
The
Receive Looperstarts On Application Load and introduce worker that handlesReceive Queueand process each message by calling event handler for each messaged added toReceive QueuefromNetwork Looper. Receive Looper handles Three types of messages:Authority-> Add Air Observed Digital Identity from X.509 Certificate to Roster.Message-> AddMessageto Chat Conversation, Add derivedAcknowledgementtoSending Queue.Ack-> RemoveMessagepacket fromSending Queue.Expiration-> Restart 3 Loopers (Receive, Send, Announce)1.4. Network Looper
The
Network Looperreceive from UDP system calls packets and adds them toReceive Queue.1.5. Expiration Event
On
Expiration Eventwhen the X.509 Digital Identity Certificate expiration happens the 3 loopers originated by application must respawnSend Looper,Receive LooperandAnnounce Looper.2. Packets
The Sokhatsky Messenger Protocol Defines 3 Message UDP Packets for Multicast Talk:
2.1. Authority Announcement
On Application Load each instance introduce its keys obtained from CA (built-in in-host) by sending 5 messages of
Authorityeach 10 seconds.2.2. Message
On Message Send application adds this message to
Sending Queue.2.3. Ack
On Message Receive application adds this message to
Sending Queue.3. Notes
3.1. Authority Looper
3.2. Send Looper
→ sends 5 identical copies with 10 seconds interval between bursts
→ both Message and Acknowledgement packets are handled the same way
3.3. Receive Looper
4. Network Looper
→ very basic validation (minimal size, version field)
→ puts raw packet into Receive Queue for further processing
Specification
Sokhatsky Messenger Protocol v1 is defined in
MESSAGE.asn1file.