# ZeusTP ## Intro First a short introduction of what networks layers are and where we will build our protocol on. ![https://media.geeksforgeeks.org/wp-content/uploads/20210220204638/cn1.png](https://media.geeksforgeeks.org/wp-content/uploads/20210220204638/cn1.png) Above you see the [7 layer OSI model](https://en.wikipedia.org/wiki/OSI_model). We will utilize the data link layer to build. This means that all layers above it will be out of scope. ## General This image represents the structure of and Ethernet Frame. ![](https://i.imgur.com/OyuSAuH.png) We will follow this structure and we add some extra structure in the Data block. **Header is 14 bytes** - Destination MAC: `<6 bytes>` - Source MAC: `<6 bytes>` - Protocol: `<2 bytes>` **After that we add our custom data** - Padding: `<2 bytes>` - Sup-protocol: `<2 bytes>` - Message: `<42-1496 bytes>` A list of already existing ethernet protocol types: [list of used protocol types](https://www.cavebear.com/archive/cavebear/Ethernet/type.html) # Protocollen ## Registratie - Protocol: `0x5001` 1. Client: Ik heb deze naam(broadcast) 2. Server: Oke je krijgt deze callsign | Error: Die naam heeft al callsign XXY ### Detail Client kiest een naam -> X - Dest: Broadcast - Src: Client MAC - Message: `[Registratie_type: 0x00][Ik wil X zijn]` Server antwoord callsign -> Y `[A-Z]{2}[0-9]` - Dest: Client MAC - Src: Server MAC - Message: `[Registratie_type: 0x01][Je callsign is Y]` Error - Dest: Client MAC - Src: Server MAC - Message: `[Registratie_type: 0x99][Hopefully some useful info]` ### Types - 0x00: Aanvraag voor callsign van naam - 0x01: Antwoord met callsign - 0x99: Er is iets fout gegaan ## ARP - Protocol: `0x5002` ### Detail 1. Client1 zoekt een id -> X - Dest: Broadcast - Src: Client1 MAC - Message: `[ARP_type: 0x00][Wie is X]` 2. Client2 met id X antwoord - Dest: Client1 MAC - Src: Client2 MAC - Message: `[ARP_type: 0x01][Ik ben X]` ### Types - 0x00: Wie is _id_ - 0x01: Ik ben X ## Data connectie - Protocol: `0x5003` 1. Client stuurt bericht - Dest: Server mac - Src: Client mac - Message: `[Data_type: 0x00][Src_id <4 bytes>: client callsign][Ping]` 2. Server antwoord - Dest: Client mac (gevonden via arp) - Src: Server mac - Message: `[Data_type: 0x01][Src_id <4 bytes: server callsign>][Pong <some hash>]`