Skip to content

Commit

Permalink
[networking] Fix Chapar & GP to new networking spec
Browse files Browse the repository at this point in the history
- All protocols in networking must be declare as a `Frame` structure
- Moved some unrelated details from `Chapar` to `networking` and `Asb` RFCs
- some minor fixes and improvements
  • Loading branch information
OmidHekayati committed Jun 30, 2023
1 parent c3e7cdd commit 1bd7a4b
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 92 deletions.
20 changes: 20 additions & 0 deletions networking-frame-signature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Special Signature Frame (MAC, Tag, ...)
This is special frame that don't need `Type` field and always appear in the end of a packet(or a frame). Due to carry on end of each packet(or frame) it must be in reverse to read its fields. Depend on crypto mode it use to authenticate data transmitted and check packet(or frame) healthy in any network hop, But usually just first router and receiver check packet(or frame) signature.

```go
type PacketSignature struct {
Signature []byte
SignatureScheme uint16 // SignatureScheme identifies a signature algorithm supported by TLS. See RFC 8446, Section 4.2.3.
Length uint16 // including the header fields
}
```

## Padding Frame
If block cipher use, add some random data to have fix size packet in random location of the frame.

```go
type Padding struct {
Length uint16
Padding []byte
}
```
38 changes: 37 additions & 1 deletion networking-osi_1-Asb.md
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# Asb - Physical Protocol
# Asb - Physical Protocol

- This Frame structure will transport by physical layer so it is payload of desire frame and that frame have its header and structure like StartDelimiter, EndDelimiter, CheckSequence, ...

## Hardwares
Chapar functions can add by switching fabric unit (SFU) in any devices by any interfaces like PCIe, .... It can have 1 to 256 wired port or 2^16(65536) wireless port.

### Core
The line processing unit (LPU) provides physical interfaces connecting the SFU(switching fabric unit) to external networks. The LPU processes and forwards service data. In addition, the LPU maintains and manages link protocols and frames congestions.

### Port Types
- RJ45 Port. RJ45 port (on 100/1000BASE Ethernet layer one) can be used in most cases.
- SFP Port
- SFP+ Port
- SFP28 Port
- QSFP+ Port
- QSFP28 Port
- Combo Port
- Stack Port

### Adaptor
Suggest to be addable port protocol like [SFP](https://en.wikipedia.org/wiki/Small_form-factor_pluggable_transceiver).

### Port Interfaces
offer diverse wired and wireless interfaces, for example, Ethernet(Layer1), [Power-line Communication](https://en.wikipedia.org/wiki/Power-line_communication), radio frequency(RF), RS485, RS232, ...

### Wireless Access Point
Each Chapar wireless ap device handles two hops of the frame instead of regular one hop in each switching hop. It means each wireless ap can serve 2^16(65536) devices.
Like other wireless technology, We must provide some dedicate channel:
- Broadcast control channel (BCCH) to manage broadcasting for all user equipment
- Paging control channel (PCCH) to manage paging messages --- why not page device by DTCH?????
- Common control channel (CCCH) and dedicated control channel (DCCH) for common messages for all user equipment in the same cell
- Dedicated traffic channel (DTCH) to send data to the specific user equipment in a cell

Use channel 49 (694-790 MHz) in [UHF](https://en.wikipedia.org/wiki/Ultra_high_frequency) frequency range to broadcast available

Each Chapar wireless ap device handles two hops of the frame instead of regular one hop in each switching hop. It means each wireless ap can serve 2^16(65536) devices. Chapar can help layer 1 protocols to made connections betweeen AP and clients.
53 changes: 6 additions & 47 deletions networking-osi_2-Chapar.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,22 @@ A Chaparkhane device (router) with 32GB of ram easily handle all connections if
- Three-tier network with core/distribution/[wireless-access](#Wireless). With just 1 core chapar switch and 256 distribution chapar switches and 65280 wireless-access switches can connect 4,261,478,400(65280\*65280) host to the network of course with just one physical link between core/distribution/wireless-access switches. If we want 2 core switches and each wireless-access switch connect to two distribution switches can connect 4,228,120,576(65024\*65024) host to the network.

## Frame architecture
- This Frame structure will transport by physical layer so it is payload of desire frame and that frame have its header and structure like StartDelimiter, EndDelimiter, CheckSequence, ...
- Ports number can be mutable due to physical link limits. The endpoint must beware of this aspect.
- Each switch interface in any location of link can be wired or wireless with any Energy||Frequency specs (e.g. Fiber, WiFi, LAN, Bluetooth, ...)

| bit | Length(byte-Octet) | Data |
| :---: | :---: | :---: |
| 0 | 1 | Next Hop |
| 0 | 1 | FrameID |
| 8 | 1 | Hop Count |
| 16 | 1 | Next Header |
| 16 | 1 | Next Hop |
| 24 | 1 | First Hop Port Number |
| ... | ~ | x Hop Port Number (Optional) |
| ... | ~ | Payload |

- FrameID: Indicate by [networking rules](./networking.md).
- [Hop Count](https://en.wikipedia.org/wiki/Hop_(networking)#Hop_count): The hop count refers to the number of intermediate network devices through which data must pass between source and destination, and also indicate frame length.
- [Next Hop](https://en.wikipedia.org/wiki/Hop_(networking)#Next_hop): Indicate hop number that frame must send on indicate port by that hop.
- [Hop Count](https://en.wikipedia.org/wiki/Hop_(networking)#Hop_count): The hop count refers to the number of intermediate network devices through which data must pass between source and destination and also indicate payload location.
- Next Header: Indicate upper layer protocol equal EtherType.
- First Hop Port Number: Source Port Number, also can be Destination Port Number in P2P(Point to Point) connection.
- x Hop Port Number: Up to 255 hop port number can be in a frame.
- Payload: Can be any upper-layer packet data that type indicates by the next header.

## Frame Types
Chapar support **UniCast** and **BroadCast** frame and not support **AnyCast** or **MultiCast**. We strongly suggest use broadcast frames just in network discoverable mechanism like find GP network coordinators. Also to broadcast emergency messages service, not to use to broadcast video channels, ...
Expand All @@ -75,56 +72,18 @@ A situation might be occur that a port available when a frame queued but when th
## Rules
- Frame size can be up to 8192 Byte or 8KB. Enough to stream 1.5Mbps video call in each 40ms frames (`1.5/8*1024/1000*40=7.68KB`).
- Due to the frame must have at least one hop, Use unused HopCount==0 for broadCast frames to all ports. So both HopCount==0x00 & HopCount==0xff have 255 hop port number space in frame header.
- BroadCast frame must have all hop port number space with 0-byte data in the header, otherwise frame payload rewrite by switches devices.
- BroadCast frame must have all hop port number space with 0-byte data in the header, otherwise other frames in the packet manipulates(rewrite) by switches devices.
- When two peer connect by two different port number, one of them must be as switching adaptor. That means **usually higher hop** must add virtual switch hop to switching road. It will add one more hop port number in each chapar frame.
- In each hop, the Switch device must rewrite the received port number on the frame. The reasons are:
- BroadcastFrame: To improve performance, the previous switch just sends a frame without declaring the next port.
- UnicastFrame: To be sure receive port is the same with declaration one in a frame.
- Rule&Security: To be sure the physical network port is the same on the sender and receiver switch.

## Next-Header Standard Supported Protocols
- 0 : [sRPC - sRPC Protocol](./sRPC.md)
- 1 : [GP - Giti Protocol](./Giti-Network.md)
- 2 : [IPv6 - Internet Protocol v6](https://en.wikipedia.org/wiki/IPv6)
- 3 : [NTP - Network_Time_Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol)

### Non supported [EtherType](https://en.wikipedia.org/wiki/EtherType)
- [ARP - Address Resolution Protocol](https://en.wikipedia.org/wiki/Address_Resolution_Protocol)
- [IPv4 - Internet Protocol v4](https://en.wikipedia.org/wiki/IPv4)
- [NDP - Neighbor Discovery Protocol](https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol)
- [VLANs](https://en.wikipedia.org/wiki/IEEE_802.1Q)

## Hardwares
Chapar functions can add by switching fabric unit (SFU) in any devices by any interfaces like PCIe, .... It can have 1 to 256 wired port or 2^16(65536) wireless port.

### Core
The line processing unit (LPU) provides physical interfaces connecting the SFU(switching fabric unit) to external networks. The LPU processes and forwards service data. In addition, the LPU maintains and manages link protocols and frames congestions.

### Port Types
- RJ45 Port. RJ45 port (on 100/1000BASE Ethernet layer one) can be used in most cases.
- SFP Port
- SFP+ Port
- SFP28 Port
- QSFP+ Port
- QSFP28 Port
- Combo Port
- Stack Port

### Adaptor
Suggest to be addable port protocol like [SFP](https://en.wikipedia.org/wiki/Small_form-factor_pluggable_transceiver).

### Port Interfaces
offer diverse wired and wireless interfaces, for example, Ethernet(Layer1), [Power-line Communication](https://en.wikipedia.org/wiki/Power-line_communication), radio frequency(RF), RS485, RS232, ...

### Wireless Access Point
Each Chapar wireless ap device handles two hops of the frame instead of regular one hop in each switching hop. It means each wireless ap can serve 2^16(65536) devices.
Like other wireless technology, We must provide some dedicate channel:
- Broadcast control channel (BCCH) to manage broadcasting for all user equipment
- Paging control channel (PCCH) to manage paging messages --- why not page device by DTCH?????
- Common control channel (CCCH) and dedicated control channel (DCCH) for common messages for all user equipment in the same cell
- Dedicated traffic channel (DTCH) to send data to the specific user equipment in a cell

Use channel 49 (694-790 MHz) in [UHF](https://en.wikipedia.org/wiki/Ultra_high_frequency) frequency range to broadcast available
Chapar can help layer 1 protocols to made connections betweeen AP and clients. Suggest each Chapar wireless ap device handles two hops of the frame instead of regular one hop in each switching hop. It means each wireless ap can serve 2^16(65536) devices.

## Inspired of
- https://guifi.net/
Expand Down
15 changes: 6 additions & 9 deletions networking-osi_3-Giti-Network.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ In the IoE (the Internet of Everything or IoT as the Internet of Things) era, we
- Free, automated, and floating to lease new GP address
- GP routers can be network coordinators alongside being a gateway

## Packet Architecture
**Frames** are Always encrypted. at least two(always the special signature frame appear at the end) or more frames in [sRPC format](./sRPC.md)
## Frame architecture

| bit | Length(Byte-Octet)| Data |
| :---: | :---: | :---: |
| 0 | 16 | Destination GP |
| 128 | 16 | Source GP |
| 256 | ~ | Frames |
| 0 | 1 | FrameID |
| 8 | 16 | Destination GP |
| 136 | 16 | Source GP |

### Compare with IPv6 packet
- **Versioning**: Unlike IP, GP don't offer any versioning for the protocol as we believe if we need fundamentally change any part of a protocol after the official release, we will already make new protocol. So we respect data link layers protocols like Ethernet and use their solution like [Ethertype](https://en.wikipedia.org/wiki/Ethertype) in [Ethernet frame](https://en.wikipedia.org/wiki/Ethernet_frame) header and don't reinvent other solution.
- **Flow Label**: Almost same as Packet Number in sRPC PacketSequenceNumber frame.
- **Payload Length**: Due to a GP packet isn't chain of related frames and haven't primary frame, Each frame has its own length if need it.
- **Next Header**: Due to a GP packet isn't chain of related frames and haven't primary frame, Each frame has its own *Type* to introduce itself.
- **Next Header**: Due to a GP is a frame inside a packet and it isn't chain of related frames and haven't primary frame, Each frame has its own *FrameID* to introduce itself.
- **Extended header**: GP uses standalone frames instead of chain of frames as primary frame and extended headers.
- **Hop Limit**: GP suggest some mechanism in [ChaparKhane](./ChaparKhane.md) as its network router||coordinator to reach this requirement.

Expand Down Expand Up @@ -86,15 +85,13 @@ Due to the nature of this spec that must be decentralized, and we believe this t
## Supported programming languages
It is so simple protocol that can easily encode and decode in any programming language. We implement it on some language like [C](), [Go](https://github.com/GeniusesGroup/libgo/blob/master/GP), [JavaScript]() and more in progress ...

## Inspired of
## Related Projects
- [Application-Layer Traffic Optimization (ALTO) Protocol](https://www.rfc-editor.org/rfc/rfc7285.html)
- [QUIC](https://en.wikipedia.org/wiki/QUIC) - [RFC](https://datatracker.ietf.org/doc/html/rfc9000)
- [HTTP2]() - [RFC](https://tools.ietf.org/html/rfc7540)
- [IPv6](https://en.wikipedia.org/wiki/IPv6) - [RFC]()
- [Blockchain models for universal connectivity](https://www.semanticscholar.org/paper/Blockchain-models-for-universal-connectivity-Navarro-Castro/788b7a634b369d98e72ed37c5fdf71f7fd62ef0b) - [PDF](https://pdfs.semanticscholar.org/788b/7a634b369d98e72ed37c5fdf71f7fd62ef0b.pdf?_ga=2.260489549.1562006812.1569054619-1995410782.1569054619)
- [Matrix, An open network for secure, decentralized communication](https://matrix.org/)

## Other projects
- [Homa](https://github.com/PlatformLab/HomaModule/)

## Articles
Expand Down
46 changes: 36 additions & 10 deletions networking.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
# Networking
All requirements in networking response with `frame` idea. Each network packet contains many frames in desire order that read by devices in a network to do some desire logic in each device, e.g. switching, routing, multiplexing, ...

## Packet
Strongly suggest respect OSI network model and order frames in any packet in OSI layers order. Strongly suggest **Frames** after layer 3 always encrypted.
A packet at least have two(always the special signature frame appear at the end) or more frames in [sRPC format](./sRPC.md)

## Frames
As describe in [sRPC](./sRPC.md) too, Each packet can carry many frames until respect network MTU. All frames have fixed first field name `Type` with `signed 8bit` length (Negative frame type reserved and use to extend types to int16 (or int64) length) that is same as [MediaTypeID](./media-type.md) but not use 64bit unsigned integer and standard here as a byte to minimize packet unnecessary overhead.
Frames indicate in each protocol RFC or in [sRPC Protocol](./sRPC.md).

### Fields
As describe in [sRPC](./sRPC.md) too, Each packet can carry many frames until respect network MTU. All frames have fixed first field name `FrameID` with `unsigned 8bit` length, that is same as [MediaTypeID](./media-type.md) but not use 64bit unsigned integer and standard here as a byte to minimize packet unnecessary overhead.

```go
type Frames struct {
Type int16
FrameID byte
}
```

## Frames Number
frames number will be register here in this table and must be respect by all:
### Frames Number
frames number will be register here in this table and must be respect by all. Number greater than 240 (FrameID > 240) use for experimental protocols and SHOULD ignore by any device that don't want to process them.

| Num. | Frame name | Doc |
| :---: | :---: | :---:|
| Num. | Frame name | Doc |
| :---: | :---: | :---: |
| 0 | Unset | -------- |
| 1 | Asb | [Protocol](./networking-osi_1-Asb.md) |
| 2 | | |
| 3 | | |
| 4 | | |
| 5 | | |
| 2 | Chapar | [Protocol](./networking-osi_2-Chapar.md) |
| 3 | GP | [Protocol](./networking-osi_3-Giti-Network.md) |
| 4 | | |
| 5 | | |
| 127 | | |
| 128 | Padding | [Protocol](./networking-frame-signature.md) |
| 129 | PacketSequenceNumber | [Protocol](./sRPC.md) |
| 130 | Ping | [Protocol](./sRPC.md) |

#### Suggested experimental protocols
Below frames can't use directly and must wrap inside a frame with `FrameID` in declared number. Some other can be find on [EtherType](https://en.wikipedia.org/wiki/EtherType).

| Num. | Frame name | Doc |
| :---: | :---: | :---: |
| 241 | ARP | [ARP - Address Resolution Protocol](https://en.wikipedia.org/wiki/Address_Resolution_Protocol) |
| 242 | VLANs | [VLANs](https://en.wikipedia.org/wiki/IEEE_802.1Q) |
| 243 | IPV4 | [IPv4 - Internet Protocol v4](https://en.wikipedia.org/wiki/IPv4) |
| 244 | IPV6 | [IPv6 - Internet Protocol v6](https://en.wikipedia.org/wiki/IPv6) |
| 245 | NDP | [NDP - Neighbor Discovery Protocol](https://en.wikipedia.org/wiki/Neighbor_Discovery_Protocol) |
| 246 | NTP | [NTP - Network_Time_Protocol](https://en.wikipedia.org/wiki/Network_Time_Protocol) |

### Methods
Due some frames can work without need to have `Length` field, instead All frames handler must provide `NextFrame() []byte` method.
Loading

0 comments on commit 1bd7a4b

Please sign in to comment.