NetSim Source Code Help v14.4
All 13 Components
 
Loading...
Searching...
No Matches
BRP.h
1/************************************************************************************
2 * Copyright (C) 2023 *
3 * TETCOS, Bangalore. India *
4 * *
5 * Tetcos owns the intellectual property rights in the Product and its content. *
6 * The copying, redistribution, reselling or publication of any or all of the *
7 * Product or its content without express prior written consent of Tetcos is *
8 * prohibited. Ownership and / or any other right relating to the software and all *
9 * intellectual property rights therein shall remain at all times with Tetcos. *
10 * *
11 * Author: Shashi Kant Suman *
12 * *
13 * ---------------------------------------------------------------------------------*/
14
15
16/************************************************************************************
17https://tools.ietf.org/html/draft-ietf-manet-zone-brp-02
18************************************************************************************/
19#pragma once
20#ifndef _NETSIM_BRP_H_
21#define _NETSIM_BRP_H_
22#ifdef __cplusplus
23extern "C" {
24#endif
25
26#define NW_PROTOCOL_BRP NW_PROTOCOL_ZRP
27#define BRP_PACKET_SIZE 32 //Bytes
28
29//API
30#define flushBodercastTree(brp) { while(brp->bodercastTree) LIST_FREE((void**)&brp->bodercastTree,brp->bodercastTree);}
31
32 typedef struct stru_BRP_Header BRP_HEADER;
33 typedef struct stru_BodercastTree BRP_BODERCAST_TREE;
34 typedef struct stru_BRP NODE_BRP;
35
36
37 /*
38 A. Packet Format
39
40 1 2 3
41 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
42 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
43 | Query Source Address |
44 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
45 | Query Destination Address |
46 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
47 | Query ID |Query Extension| RESERVED |
48 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
49 | Prev Bordercast Address |
50 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
51 | |
52 | E N C A P S U L A T E D P A C K E T |
53 | |
54 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
55 */
57 {
58 NETSIM_IPAddress QuerySourceAddress;
59 NETSIM_IPAddress QueryDestinationAddress;
60 unsigned short int QueryID;
61 unsigned char QueryExtension;
62 unsigned char RESERVED;
63 NETSIM_IPAddress PrevBordercastAddress;
64 NetSim_PACKET* EncapsulatedPacket;
65 };
66
68 {
69 NETSIM_IPAddress borderIP;
70 NETSIM_ID boderId;
71 NETSIM_IPAddress nexthop;
72 _ele* ele;
73 };
74#define BRP_BODERCAST_TREE_ALLOC() (struct stru_BodercastTree*)list_alloc(sizeof(struct stru_BodercastTree),offsetof(struct stru_BodercastTree,ele))
75
76 struct stru_BRP
77 {
78 BRP_BODERCAST_TREE* bodercastTree;
79 unsigned short int nQueryId;
80 };
81
82 //Function prototype
83 int fn_NetSim_BRP_Init();
84 int fn_NetSim_BRP_CopyBRPHeader(const NetSim_PACKET* destPacket,const NetSim_PACKET* srcPacket);
85 int fn_NetSim_BRP_FreeBRPHeader(NetSim_PACKET* packet);
86 int addToBodercastTree(NODE_BRP* brp,
87 NETSIM_IPAddress boderIP,
88 NETSIM_IPAddress nextHop);
89 int fn_NetSim_BRP_BodercastPacket(NetSim_PACKET* dataPacket);
90 int fn_NetSim_BRP_ProcessPacket();
91 int fn_NetSim_BRP_Update(ptrIP_ROUTINGTABLE iarpTable);
92#ifdef __cplusplus
93}
94#endif
95#endif
Definition BRP.h:77