-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathicp.h
29 lines (27 loc) · 1020 Bytes
/
icp.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef IPC_H
#define IPC_H
#define DEBUG
#include<stdio.h>
int whichEndian();
struct ICP {
unsigned char version; /* Version: 2 bits */
unsigned char startbit; /* SB: 1 bit */
unsigned char endbit; /* EB: 1 bit */
unsigned char ackbit; /* AB: 1 bit */
unsigned char cackbit; /* CAB: 1 bit */
unsigned char kalive; /* KAB: 1 bit */
unsigned char frag; /* FB: 1 bit */
unsigned short size; /* Size: 16 bits */
unsigned short seq; /* Sequence: 16 bits */
unsigned short ack; /* Acknowledgement: 16 bits */
//Binary
unsigned char buffer[8];
};
void toBinary(struct ICP * icp);
void toValues(struct ICP * icp);
inline void updateICP(struct ICP * icp,unsigned char sb,unsigned char eb,unsigned char ab,
unsigned char cab,unsigned char ka,unsigned char fr,unsigned short s,
unsigned short seq,unsigned short ack);
void printICPIn(struct ICP * icp);
void printICPOut(struct ICP * icp);
#endif