|
Project 1 - Peer-to-peer and interface protocols using C
1.0
A half-duplex layered communication system.
|
Layer 2 provides the transmission and receipt of a chunk of data. More...
#include "layer.h"Macros | |
| #define | LAYER2_H |
| #define | SCHKSZE 2 /* small check size */ |
Functions | |
| int | layer2_write (char *chunk, int len) |
| Sends a chunk that consists of the sequence of bytes starting at the address specified by the first parameter (chunk) with length len. More... | |
| int | layer2_read (char *chunk, int max) |
| Reads a chunk and stores the incoming bytes in the buffer starting at the address specified by the first parameter (chunk). More... | |
Layer 2 provides the transmission and receipt of a chunk of data.
DETAILED DESCRIPTION
Peer-to-peer and Interface Protocols Using C
Compile with: gcc -c layer4.c -o ../build/layer4.o
| int layer2_read | ( | char * | chunk, |
| int | max | ||
| ) |
Reads a chunk and stores the incoming bytes in the buffer starting at the address specified by the first parameter (chunk).
| [in] | chunk | A sequence of bytes whose length is no greater than 16 bytes as defined by MAX_CHUNK_SIZE which can contain any type of data. |
| [in] | max | No more than max bytes will be put into chunk, so max limits the size of the chunk read. |
| int layer2_write | ( | char * | chunk, |
| int | len | ||
| ) |
Sends a chunk that consists of the sequence of bytes starting at the address specified by the first parameter (chunk) with length len.
| [in] | chunk | The data to write using layer 1 protocols. |
| [in] | len | The size of the chunk to write. |
1.8.3.1