forked from sachinites/tcpip_stack
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comm.h
70 lines (60 loc) · 2.42 KB
/
comm.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
/*
* =====================================================================================
*
* Filename: comm.h
*
* Description: This file defines the structures to setup communication between
* nodes of the topology
*
* Version: 1.0
* Created: Thursday 19 September 2019 10:26:16 IST
* Revision: 1.0
* Compiler: gcc
*
* Author: Er. Abhishek Sagar, Networking Developer (AS), [email protected]
* Company: Brocade Communications(Jul 2012- Mar 2016), Current : Juniper Networks(Apr 2017 - Present)
*
* This file is part of the NetworkGraph distribution (https://github.com/sachinites).
* Copyright (c) 2017 Abhishek Sagar.
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
* =====================================================================================
*/
#ifndef __COMM__
#define __COMM__
#define MAX_PACKET_BUFFER_SIZE 2048
typedef struct node_ node_t;
typedef struct interface_ interface_t;
int
send_pkt_to_self(char *pkt, unsigned int pkt_size, interface_t *interface);
/* API to send the packet out of the interface.
* Nbr node must receieve the packet on other end
* of the link*/
int
send_pkt_out(char *pkt, unsigned int pkt_size, interface_t *interface);
/*API to recv packet from interface*/
int
pkt_receive(node_t *node, interface_t *interface,
char *pkt, unsigned int pkt_size);
/* API to flood the packet out of all interfaces
* of the node*/
int
send_pkt_flood(node_t *node,
interface_t *exempted_intf,
char *pkt, unsigned int pkt_size);
/*API to flood the pkt out of all L2 interface of the node*/
int
send_pkt_flood_l2_intf_only(node_t *node,
interface_t *exempted_intf,
char *pkt, unsigned int pkt_size);
#endif /* __COMM__ */