NetSim Source Code Help
Loading...
Searching...
No Matches
OpenFlow.h
Go to the documentation of this file.
1#pragma once
2/************************************************************************************
3* Copyright (C) 2020 *
4* TETCOS, Bangalore. India *
5* *
6* Tetcos owns the intellectual property rights in the Product and its content. *
7* The copying, redistribution, reselling or publication of any or all of the *
8* Product or its content without express prior written consent of Tetcos is *
9* prohibited. Ownership and / or any other right relating to the software and all *
10* intellectual property rights therein shall remain at all times with Tetcos. *
11* *
12* Author: Shashi Kant Suman *
13* *
14* ---------------------------------------------------------------------------------*/
15
16#ifndef _NETSIM_SDN_H_
17#define _NETSIM_SDN_H_
18#ifdef __cplusplus
19extern "C" {
20#endif
21
22#pragma comment(lib,"NetworkStack.lib")
23
24 //Default config parameter
25#define OPENFLOW_SDN_CONTROLLER_DEFAULT false
26#define OPENFLOW_OPEN_FLOW_ENABLE_DEFAULT false
27#define OPENFLOW_SDN_CONTROLLER_DEVICE_DEFAULT _strdup("unknown")
28
29 typedef struct stru_clientInfo
30 {
35 struct stru_clientInfo* next;
37
38 typedef struct stru_controllerInfo
39 {
45
46 typedef struct stru_HandleInfo
47 {
49 void* handle;
52
53 typedef struct stru_openflow
54 {
57
59
62
64 {
68
72#define GET_OPENFLOW_VAR(d) ((ptrOPENFLOW)(DEVICE_APPVAR(d,APP_PROTOCOL_OPENFLOW)))
73#define SET_OPENFLOW_VAR(d,var) (fn_NetSim_Stack_SetAppProtocolData(d,APP_PROTOCOL_OPENFLOW,var))
74
75#define OFMSG_OVERHEAD 50
76#define OFMSG_PORT 99
78 {
82
83 typedef struct stru_openFlowMsg
84 {
87 void* payload;
88 int len;
89 bool isMore;
91
92 //Open flow utility function
95
96 //CLI Interface
97 void handle_cli_input();
98 char* openFlow_execute_command(void* handle, NETSIM_ID d, UINT id, int* len, bool* isMore);
100 UINT id,
101 void* handle);
103 UINT id);
104
105 //SDN Controller
108 NETSIM_ID ci,
109 UINT16 port);
111
112 //Open flow msg
114 void* handle,
115 void* command,
116 UINT len);
118 UINT id,
119 char* payload,
120 int len,
121 bool isMore);
123 UINT id,
124 void* msg,
125 int len,
126 bool isMore);
127
128#ifdef __cplusplus
129}
130#endif
131#endif
unsigned int NETSIM_ID
Definition: Animation.h:45
static ANIM_HANDLE handle
Definition: BatteryModel.c:197
#define UINT
Definition: Linux.h:38
#define UINT16
Definition: Linux.h:33
void openFlow_add_new_client(NETSIM_ID ct, NETSIM_ID ci, UINT16 port)
Definition: SDNController.c:40
struct stru_openFlowMsg * ptrOPENFLOWMSG
struct stru_controllerInfo * ptrSDNCONTROLLERINFO
struct stru_openflow OPENFLOW
struct stru_HandleInfo * ptrHANDLEINFO
ptrSDNCLIENTINFO openFlow_find_clientInfo(NETSIM_ID ct, NETSIM_ID ci)
Definition: SDNController.c:27
struct stru_openflow * ptrOPENFLOW
void openFlow_print_response(NETSIM_ID d, UINT id, void *msg, int len, bool isMore)
Definition: CLIInterface.c:167
struct stru_controllerInfo SDNCONTROLLERINFO
void openFlow_send_response(NETSIM_ID dev, UINT id, char *payload, int len, bool isMore)
Definition: OpenFlowMsg.c:145
bool isSDNController(NETSIM_ID d)
Definition: SDNController.c:17
ptrHANDLEINFO openFlow_getHandle(NETSIM_ID d, UINT id)
Definition: CLIInterface.c:39
struct stru_HandleInfo HANDLEINFO
bool isOPENFLOWConfigured(NETSIM_ID d)
Definition: OpenFlow.c:194
struct stru_openFlowMsg OPENFLOWMSG
void openFlow_saveHandle(NETSIM_ID d, UINT id, void *handle)
Definition: CLIInterface.c:18
struct stru_clientInfo * ptrSDNCLIENTINFO
enum enumOpenFlowMsgType OFMSGTYPE
char * openFlow_execute_command(void *handle, NETSIM_ID d, UINT id, int *len, bool *isMore)
Definition: CLIInterface.c:159
bool fn_NetSim_OPEN_FLOW_SendCommand(NETSIM_ID dest, void *handle, void *command, UINT len)
Definition: OpenFlowMsg.c:110
enumOpenFlowMsgType
Definition: OpenFlow.h:78
@ OFMSGTYPE_COMMAND
Definition: OpenFlow.h:79
@ OFMSGTYPE_RESPONSE
Definition: OpenFlow.h:80
NETSIM_IPAddress openFlow_find_client_IP(NETSIM_ID d)
Definition: OpenFlow.c:237
void handle_cli_input()
Definition: CLIInterface.c:115
struct stru_clientInfo SDNCLIENTINFO
@ APP_PROTOCOL_OPENFLOW
Definition: Stack.h:158
struct stru_HandleInfo * next
Definition: OpenFlow.h:50
void * handle
Definition: OpenFlow.h:49
NETSIM_ID clientId
Definition: OpenFlow.h:31
NETSIM_IPAddress clientIP
Definition: OpenFlow.h:33
struct stru_clientInfo * next
Definition: CLI.h:87
UINT16 clientPort
Definition: OpenFlow.h:32
ptrSOCKETINTERFACE sock
Definition: OpenFlow.h:34
NETSIM_IPAddress controllerIP
Definition: OpenFlow.h:41
NETSIM_ID controllerId
Definition: OpenFlow.h:40
ptrSOCKETINTERFACE sock
Definition: OpenFlow.h:43
void * payload
Definition: OpenFlow.h:87
OFMSGTYPE msgTYpe
Definition: OpenFlow.h:86
NETSIM_ID sdnControllerId
Definition: OpenFlow.h:61
UINT msgId
Definition: OpenFlow.h:69
ptrHANDLEINFO handleInfo
Definition: OpenFlow.h:70
char * sdnControllerDev
Definition: OpenFlow.h:60
NETSIM_IPAddress myIP
Definition: OpenFlow.h:58
bool isSDNController
Definition: OpenFlow.h:56
union stru_openflow::sdn_info INFO
bool isSDNConfigured
Definition: OpenFlow.h:55
ptrSDNCLIENTINFO clientInfo
Definition: OpenFlow.h:66
ptrSDNCONTROLLERINFO controllerInfo
Definition: OpenFlow.h:65