XenevaOS
Loading...
Searching...
No Matches
tcp.h
Go to the documentation of this file.
1
30#ifndef __TCP_H__
31#define __TCP_H__
32
33#include <list.h>
34#include <Net/socket.h>
35#include <Net/ipv4.h>
36#include <Fs/vfs.h>
37
38#define TCP_FLAGS_FIN (1<<0)
39#define TCP_FLAGS_SYN (1<<1)
40#define TCP_FLAGS_RST (1<<2)
41#define TCP_FLAGS_PSH (1<<3)
42#define TCP_FLAGS_ACK (1<<4)
43#define TCP_FLAGS_URG (1<<5)
44#define TCP_FLAGS_ECE (1<<6)
45#define TCP_FLAGS_CWR (1<<7)
46#define TCP_FLAGS_NS (1<<8)
47#define TCP_DATA_OFFSET_5 (0x5 << 12)
48
49#define TCP_DEFAULT_WIN_SZ 65535
50
51
52#pragma pack(push,1)
53__declspec(align(2))
54typedef struct _tcphead_ {
55 unsigned short srcPort;
56 unsigned short destPort;
57 unsigned sequenceNum;
58 unsigned ackNum;
59 unsigned short dataOffsetFlags;
60 unsigned short window;
61 unsigned short checksum;
62 unsigned short urgentPointer;
64#pragma pack(pop)
65
66/*
67* CreateTCPSocket -- creates a new TCP Socket
68*/
69extern int CreateTCPSocket();
70
71/*
72 * TCPGetSocketList -- return the current socket
73 * list of TCP
74 */
75extern list_t* TCPGetSocketList();
76
77/*
78 * AuTCPAcknowledge -- send ack packets
79 * @param nic -- Pointer to NIC device
80 * @param sock -- Pointer to session socket
81 * @param ippack -- Pointer to IPv4 packet
82 * @param payloadLen -- length of the payload
83*/
84extern int AuTCPAcknowledge(AuVFSNode* nic, AuSocket* sock, IPv4Header* ippack, size_t payloadLen);
85
86/*
87 * TCPProtocolInstall -- initialize the TCP protocol
88 */
89extern void TCPProtocolInstall();
90
91#endif
AuVFSNode * nic
Definition e1000.cpp:67
IPv4Header
Definition ipv4.h:47
Definition vfs.h:89
Definition list.h:46
Definition socket.h:98
int CreateTCPSocket()
Definition tcp.cpp:345
__declspec(align(2)) typedef struct _tcphead_
Definition tcp.h:53
list_t * TCPGetSocketList()
Definition tcp.cpp:379
void TCPProtocolInstall()
Definition tcp.cpp:386
TCPHeader
Definition tcp.h:63
int AuTCPAcknowledge(AuVFSNode *nic, AuSocket *sock, IPv4Header *ippack, size_t payloadLen)
Definition tcp.cpp:161