NetSim Source Code Help
Loading...
Searching...
No Matches
SDNController.c
Go to the documentation of this file.
1/************************************************************************************
2* Copyright (C) 2020 *
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#include "main.h"
15#include "OpenFlow.h"
16
18{
20 if (of)
21 {
22 return of->isSDNController;
23 }
24 return false;
25}
26
28{
31 while (sd)
32 {
33 if (sd->clientId == ci)
34 return sd;
35 sd = sd->next;
36 }
37 return NULL;
38}
39
41 NETSIM_ID ci,
42 UINT16 port)
43{
45 ptrSDNCLIENTINFO sd = calloc(1, sizeof* sd);
46 sd->clientId = ci;
48 sd->clientPort = port;
53 port);
54
55 if (of->INFO.clientInfo)
56 {
58 while (t->next)
59 t = t->next;
60 t->next = sd;
61 }
62 else
63 {
64 of->INFO.clientInfo = sd;
65 }
66}
unsigned int NETSIM_ID
Definition: Animation.h:45
#define UINT16
Definition: Linux.h:33
#define calloc(c, s)
Definition: Memory.h:29
NETSIM_IPAddress openFlow_find_client_IP(NETSIM_ID d)
Definition: OpenFlow.c:237
#define GET_OPENFLOW_VAR(d)
Definition: OpenFlow.h:72
#define OFMSG_PORT
Definition: OpenFlow.h:76
void openFlow_add_new_client(NETSIM_ID ct, NETSIM_ID ci, UINT16 port)
Definition: SDNController.c:40
ptrSDNCLIENTINFO openFlow_find_clientInfo(NETSIM_ID ct, NETSIM_ID ci)
Definition: SDNController.c:27
bool isSDNController(NETSIM_ID d)
Definition: SDNController.c:17
ptrSOCKETINTERFACE fn_NetSim_Socket_CreateNewSocket(NETSIM_ID deviceId, int appProtocol, TRANSPORT_LAYER_PROTOCOL trxProtocol, UINT16 localPort, UINT16 remotePort)
@ APP_PROTOCOL_OPENFLOW
Definition: Stack.h:158
@ TX_PROTOCOL_TCP
Definition: Stack.h:180
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
bool isSDNController
Definition: OpenFlow.h:56
union stru_openflow::sdn_info INFO
ptrSDNCLIENTINFO clientInfo
Definition: OpenFlow.h:66