13
Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels, and one process_arrived_msg() No diff terms of writing app level code among intra-timeline and inter-timeline events ho st ho st ho st Timeline 1 Timeline 2 Router Router Shared Link (CSMA Ethernet, Wireless, PLC) Switched Ethernet Router-level Network ho st ho st ho st event event event event

Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Embed Size (px)

Citation preview

Page 1: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Switch

Each NicInterface has one InChannel and one OutChannelEach Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels, and one process_arrived_msg() No diff terms of writing app level code among intra-timeline and inter-timeline events

host host host

Timeline 1

Timeline 2Router

Router

Shared Link(CSMA Ethernet, Wireless, PLC)

Switched EthernetRouter-level Network

host

host

host

event

event

event

event

Page 2: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Router

TCP/UDP Session

TCP/UDP Master

IP

Network_interface Network_interface

MAC

PHY

MAC

PHY

IP (possibly switch layer too)

Network_interface Network_interface

MAC

PHY

MAC

PHY

Switch layer

Network_interface Network_interface

MAC

PHY

MAC

PHY

Switch

Forwarding table

Host

NIC_interface can contain wireless, Ethernet, Simple MAC on a single machine

Forwardingtable.hclass RouteInfo : public TrieData {}{…

IPADDR next_hop_ip;MACADDR dst_mac; //next_hop/** The network interface (this host) through which it gets to the

next hop. */Interface* nic; //from link, it can tell the dst interface

}class ForwardingTable : protected Trie {… RouteInfo* getRoute(IPADDR ipaddr); //longest prefix match}

TCP/UDP Session

TCP/UDP Session

SocketSession

Socket Session

Socket Session

APP APP APP

statemachine

statemachine

Page 3: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

SharedLink(CSMA/CD,CA)

Each NicInterface has one InChannel and one OutChannelEach Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels, and one process_arrived_msg()

host host host

host host host

Timeline 1

Timeline 2 Router

Router

Page 4: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

InChannel (1 per entity, processes: listen(), process_arrived_msg() )OutChannel (1 per NicInterface)Entity (Host, Router, Switch, SharedLink)

host host host

host host host

Timeline 1

Timeline 2

SharedLink (Ethernet, Wireless)

Router

Router

Page 5: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Class Host::Entity :: DmlObject ::ProtocolGraph{

//from Entity ltime_t now();Timeline* alignment();Handle waitFor();timeConversion double tickvector<OutChannel*> __outchannel_list; // list of outchannels owned by this entityvector<InChannel*> __inchannel_list; // list of inchannels owned by this entityvector<Process*> __process_list; // list of processes owned by this entitymap<string,Process*> ProcessName;map<string,InChannel*> InChannelName;

listen(); //listen on all inChannels (binding)process_arrived_msg(); //deliver to the right NicInterfaceNhi nhi_host;vector<NetworkInterface*>; void config(dml::Configuration *cfg);void init();rng getRandom();bool is_router;bool is_switch; //may change to dml keyword router/switch instead of host laterloadForwardingTable();

}

Page 6: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Class NetworkInterface() :DmlObject :ProtocolGraph{

Nhi, nhi_nic;IPAddr ip;MACAddr mac; OutChannel* oc;InChannel* ic;bool is_oc_connected; //default false, change when mapping to other ic bool is_ic_connected; //default false, change when other oc maps to itsendPacket(); //writeTo OC, the message (activation) may refer to SenderInfo() in milieu.hvoid attach_to_link (Link *link); //set attached_link when creating connection in Link

Link * attached_link;//LinkInfo * link_infoMACProtocolSession * mac_sess;PHYProtocolSession *phy_sess;

//statistics like [later]int inPacketsint outPacketsTCPDump * tcpdump

}

Page 7: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Class Link :: DmlObject // store info of nw_inf and their connections, delay (what delay?), may store fluid info for (dos attack){

vector <NetworkInterface*>;void connect(); //map IC and OC, getInterface from nhi (from AlignmentService)void config(dml::Configuration *cfg);void init();void display(); //maybe display all/connected interface

}

Class SharedLink::Link::Entity //todo, for wireless or CSMA/CD Ethernet{

Nhi nhi;Timeline* timeline;listen(); //listen on all inChannels (binding)process_arrived_msg(); //deliver to the right NicInterface//may override connect();

}

Page 8: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

The net class is the container for everything. All DML objects (including internal nets) must be contained in a net. Conceptually a net is just a collection of hosts and routers and other nets. The concept of a net is not that important for protocols like TCP and IP, but it's crucial for OSPF and BGP because a net can be an autonomous system (AS) or an OSPF area. This net class will start the configuration of the network. it will scan for hosts, routers, links and other nets in the DML and create/link these entities. nets also play a very important role in resolution of NHI addresses.Class Net:DmlObject{

//publicNet ()Net (Net *parent, long id)virtual ~Net ()void config (prime::dml::Configuration *cfg)void init ()virtual void display (int indent=0) //unknown what to displayDmlObject * nhi2obj (Nhi *nhi) //need to refer to ssfnet, if nhi not in this net, wil search in other

netsIPPrefix getPrefix ()SSFNET_INT2PTR_MAP & getHosts ()SSFNET_INT2PTR_MAP & getNets ()SSFNET_POINTER_VECTOR & getLinks ()

//protectedvoid config_top_net (dml::Configuration *cfg)void config_link (dml::Configuration *cfg)void config_host (dml::Configuration *cfg, SSFNET_LONG_SET &uniqset, bool is_router=false)void config_router (dml::Configuration *cfg, SSFNET_LONG_SET &uniqset)void config_net (prime::dml::Configuration *cfg, SSFNET_LONG_SET &uniqset)void connect_links ()void finish_config_top_net (dml::Configuration *cfg)

Page 9: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

//dataIPPrefix ip_prefix;SSFNET_INT2PTR_MAP hosts; //id (part of NHI) to object, need to think to

store complete NHI or only idSSFNET_INT2PTR_MAP netsSSFNET_POINTER_VECTOR linksCidrBlock * curCidr

/** A map from the host's NHI address to the host object */ HOSTNHI_OBJ_MAP host_nhi_to_obj_map;

/** A map from nic’s NHI to the network interface object */ NICNHI_OBJ_MAP nicip2obj_map;

// Register local host with given name. This method should be called in the config phase of each connected interface. void register_host(Host* host, const SSFNET_STRING& name);

// Register local interface with the given nhi. This method should be called in the config phase of each connected interface. void register_interface(Interface* iface, const SSFNET_STRING& nhi);

}

Page 10: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

//one per timeline, central place to store per-timeline info// ideal place for some func and data in community and milieuClass TimelineServices{}

Page 11: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

//global storage for all naming info, to be modified as neededClass NameSrv {

STR2STRMAP* hostname2nicnhi_map; ///< map from host name to nic NHI address

STR2STRMAP* hostnhi2hostname_map; ///< map from host NHI address to host name

STR2STRMAP* hostnhi2align_map; ///< map from host NHI to the name of the alignment it belongs

NHI2IDMAP* hostnhi2id_map; ///< map from host NHI to index of its default interface??

NHI2IPMAP* nhi2ip_map; ///< map from nic NHI to IPADDR, maybe MACADDR

IP2NHIMAP* ip2nicnhi_map; ///< map from IPADDR to NHI}

Page 12: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Class IPSession{

}

Forwardingtable.hclass RouteInfo : public TrieData {}{…

/** The IP address of the next hop. */ IPADDR next_hop;

/** The network interface through which it gets to the next hop. */Interface* nic; //from link, it can tell the dst interface

//add MACADDR for each nic interface}class ForwardingTable : protected Trie { RouteInfo* getRoute(IPADDR ipaddr);

//longest prefix match}

xx-rt.dmlforwarding_table [ node_nhi 0:0 nhi_route [ dest :0:1(0) interface 1 next_hop :0:1(0) ] nhi_route [ dest :0:2(0) interface 2 next_hop :0:2(0) ] nhi_route [ dest :1:0(0) interface 0 next_hop :1:0(0) ] nhi_route [ dest :1:0(1) interface 0 next_hop :1:0(0) ] nhi_route [ dest :1:0(2) interface 0 next_hop :1:0(0) ] nhi_route [ dest :1:1(0) interface 0 next_hop :1:0(0) ] nhi_route [ dest :1:2(0) interface 0 next_hop :1:0(0) ]]forwarding_table [ node_nhi 0:1 nhi_route [ dest default interface 0 ]]

// late protocolSession, protocolMessage

Page 13: Switch Each NicInterface has one InChannel and one OutChannel Each Entity (Host, Router, Switch, SharedLink) has one listen() process over all InChannels,

Points:1. Timeline is always from 0, say 4 timelines, 0-3

Need to make sure in dml, alignment is correct integerbeginning of dml, #timelines

2. When creating an entity, need to pass a string, maybe nhi