forked from fyhe8082/TFRC
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TCPF.h
70 lines (62 loc) · 1.82 KB
/
TCPF.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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
/*********************************************************
*
* Module Name: TCPF client/server header file
*
* File Name: TCPF.h
*
* Summary:
* This file contains common stuff for the client and server
*
* Revisions:
*
*********************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <sys/types.h>
/*largest amount of data on a socket read*/
#define MAX_BUFFER 65000
#ifndef LINUX
#define INADDR_NONE 0xffffffff
#endif
/* Message type */
#define CONTROL (0x01)
#define DATA (0x02)
#define ACK (0x03)
/* Code */
#define START (0x01)
#define STOP (0x02)
#define OK (0x03)
/* Considered as Control Message */
struct control_t {
uint32_t msgLength; /* Msg Length */
uint16_t msgType; /* Msg Type */
uint16_t code; /* Code */
uint32_t CxID;
uint32_t seqNum; /* Sequence Number*/
uint32_t msgSize /* Send Msg Size */
}
/* Considered as Data Message Format */
struct data_t {
uint32_t msgLength; /* Msg Length */
uint16_t msgType; /* Msg Type */
uint16_t code; /* Code */
uint32_t CxID; /* */
uint32_t seqNum; /* Sequence Number */
uint32_t timeStamp; /* TimeStamp */
uint32_t RTT; /* Sender's RTT Estimate (in microsecond) */
uint8_t X[0]; /* Holds Msg Data */
}
/* Considered as ACK Message Format */
struct ACK_t {
uint32_t msgLength; /* Msg Length */
uint16_t msgType; /* Msg Type */
uint16_t code; /* Code */
uint32_t CxID; /* */
uint32_t ackNum; /* ACK Number */
uint32_t timeStamp; /* TimeStamp */
uint32_t T_delay; /* T_delay (in microsecond) */
uint32_t lossRate; /* Loss Event Rate */
uint32_t recvRate; /* Receive Rate (in bits per second) */
}
void DieWithError(char *errorMessage); /* External error handling function */