CS395-0,Section22 TheMinetTCP/IPStack Dinda,Fall2000 Page1of15TheMinetTCP/IPStackIntroductionTheMinetTCP/IPStackisintendedtosupportundergraduateandgraduatecoursesincomputernetworkingthatarebasedona“studentslearnbybuildingsomethingreal”pedagogicalmodel.ThespecificgoalsofMinetarethefollowing:• MinetenablesstudentstoimplementacompatibleTCP/IPstackthatdirectlycontrolstheEthernetdevice.• MinetletstheinstructorcontrolthedegreeofaccessstudentshavetotheEthernetdevice• Minetenablesstudentstowritelow-levelnetworkingcodewhilestillworkingattheuserlevelwithafamiliardevelopmentenvironment.• Minetdoesnotrequirestudentstopossessknowledgeofprocessorthreadcontrolorsynchronization.• MinetworksonLinuxandshouldbeeasilyportabletootherUnix-likeoperatingsystems.• MinetletstheinstructorcontrolthedifficultyofanassignmentbyselectivereleaseofC++classesandMinetmodules.TheMinetstackconsistsofacollectionofmodulesthatcommunicatewitheachotherusing,forthemostpart,fifosornamedpipes.Twospecialmodules,whicharerunasrootthroughtheUnixsuidmechanism,implementtheinjectionandextractionofrawEthernetpackets.Theinstructorcanmodifythesemodulesasnecessarytocontrolthepacketsthatstudentscansee.Inaddition,itisagoodideatouseaswitchedEthernetnetworktominimizeresourceconflicts.MinetHardwareandSoftwareRequirementsThefollowinghardwareisneededtouseMinet:• IntelPCcapableofrunningLinux(ideallyatleasttwosuchPCs)• EthernetcardsupportedbyLinux• Huborswitch(formorethanonemachine)ThefollowingsoftwareisneededtouseMinet.Otherversionsmayworkaswell.• RedHatLinux6.2(Thedefaultkernelwillwork.Ifyoubuildyourown,besuretoincludepacketsocketsandBerkeleypacketfilters)• GCC2.95.219991024releaseincludingSTL• GnuMake3.78.1• libpcap0.4-19• libnet1.0.1-bCS395-0,Section22 TheMinetTCP/IPStack Dinda,Fall2000 Page2of15reader writerwriterdevice_driverethernetethernet_muxip_modulearp_moduleip_muxother_moduletcp_moduleudp_modulesock_moduleSIGUSR1Socketpair(AF_UNIX)Signallibpcap libnetFifoPairRawEthernetPacket PacketARPRequestResponseSockRequestResponseipother_modlibminet_socketapplicationSockLibRequestResposeEthernetDeviceCS395-0,Section22 TheMinetTCP/IPStack Dinda,Fall2000 Page3of15DescriptionoftheMinetStackThefacingpageillustratesthestandardMinetconfigurationasofthedateofthiswriting.Minetconsistsofmodules(thelabeledboxes),whichareseparateexecutables.Thesemodulescommunicateusingpairedfifos(heavybi-directionalarrows).ThepartsofthefigurethatareingrayaremodulesthathavenotyetbeencompletedandarenotnecessaryforbasicTCP/IPfunctionality.Adashedlinewithinamodulerepresentsadivisionbetweenalibraryandusercode.Thisdescriptionisdividedintothreepieces.First,wedescribethedatatypesthatMinetprovides.Next,wedescribethemodules,whichareimplementedusingthesedatatypes.Finally,wedescribetheinterfacesbetweenthesemodules.DataTypesMinetprovidesanumberofdatatypestosimplifydevelopment.Thissectiondescribesthemostsignificantandoftenusedofthese.Generally,Minetdatatypesare“serializable”–theysupportthemethodsSerializeandUnserialize,whichsimplifywritingthemontoafiledescriptororreadingthemfromafiledescriptor.BufferandTaggedBuffer<T>TheBufferclassprovidesthebasicdatabufferingmechanism.ATaggedBufferissimplyaBufferwithanassociatedtagoftypeT.AbufferisbasedonanSTLcrope,whichisastringclassthatisoptimizedforrapidandeasyediting.EthernetConfigAnEthernetConfigisusedtoinitializethevirtualEthernetdevice.Itconsistsofadevicenumber,flags,andapointertotheinterruptserviceroutinethatthevirtualdevicewilltrapto.EthernetAddrThisprovidesaconvenientrepresentationofandtoolsformanipulating6byteEthernetaddresses.RawEthernetPacketTheRawEthernetPacketclassisthebasicmessagetypeforthelowerlevelsofthestack.Asthenameindicates,itrepresentsarawEthernetpacket.LiketheothermessageclassesinMinet,itprovidesserializationmethodstomakeinstanceseasytocommunicate.RawEthernetPacket::Serialize(constintfd)constwritesthepackettoafiledescriptor,whileRawEthernetPacket::Unserialize(constintfd)readsthepacketfromafiledescriptor.RawEthernetPacketBufferThisclassimplementsabuffer(orqueue)ofRawEthernetPackets.Thisisdeprecated.CS395-0,Section22 TheMinetTCP/IPStack Dinda,Fall2000
View Full Document