Introductio
Thedatalinklayerdefineshowtotransmitdataonasinglelink.Theseagreementsarerelatedtothevariousmediabeingdiscussed.Examples:ATM,FDDI,etc.Thedatalinklayermusthaveaseriesofcorrespondingfunctions,mainly:howtocombinedataintodatablocks.Inthedatalinklayer,thisdatablockiscalledaframe,whichisthetransmissionunitofthedatalinklayer;howtocontroltheframeTransmissiononthephysicalchannelincludeshowtohandletransmissionerrors,howtoadjustthetransmissionratetomatchthereceiver;andtoprovidemanagementoftheestablishment,maintenance,andreleaseofdatalinkchannelsbetweentwonetworkentities.
Physicallink(physicalline):Itiscomposedoftransmissionmediumandequipment.Theoriginalphysicaltransmissionlinereferstothebasicphysicaltransmissionmediumandequipmentthatdoesnotusehigh-levelerrorcontrol.
Datalink(logicalcircuit):Onaphysicalcircuit,thetransmissionofthesedataiscontrolledthroughsomeproceduresorprotocolstoensurethecorrectnessofthetransmitteddata.Thehardwareandsoftwarethatimplementtheseproceduresorprotocolsareaddedtothephysicalcircuittoformadatalink,thetransmissionpathfromthedatasendingpointtothedatareceivingpoint.Whenmultiplexingtechnologyisused,therecanbemultipledatalinksononephysicallink.
Basicfunctions
Thedatalinklayerhastwomainfunctions:framecodinganderrorcorrectioncontrol.Frameencodingmeansdefiningadatapacketthatcontainsinformationfrequency,bitsynchronization,sourceaddress,destinationaddress,andothercontrolinformation.Thedatalinklayerprotocolisdividedintotwosub-layers:logicallinkcontrol(LLC)protocolandmediaaccesscontrol(MAC)protocol.
Themostbasicfunctionofthedatalinklayeristoprovidetransparentandreliabledatatransmissionbasicservicestousersofthislayer.Transparencymeansthatthecontent,format,andcodingofthedatatransmittedonthislayerarenotlimited,andthereisnoneedtoexplainthemeaningoftheinformationstructure;reliabletransmissionallowsuserstoavoidtheworryofmissinginformation,interferenceinformation,andincorrectorder.Thesesituationsmayoccurinthephysicallayer,anderrorcorrectioncodesmustbeusedtodetectandcorrecterrorsinthedatalinklayer.Thedatalinklayerstrengthensthefunctionofthephysicallayertotransmittheoriginalbitstream,transformingtheerror-pronephysicalconnectionprovidedbythephysicallayerintoalogicallyerror-freedatalink,makingitappearasanerror-freelinetothenetworklayer.
Framesynchronization
Inordertoretransmitonlylimiteddatawitherrorsaftererrorsoccurintransmission,thedatalinklayercombinesbitstreamsintoEthernetframesfortransmission.Inadditiontothedatatobetransmitted,eachframealsoincludesacheckcodesothatthereceivercanfinderrorsinthetransmission.Theorganizationalstructureoftheframemustbedesignedsothatthereceivercanclearlyidentifyitfromthebitstreamreceivedbythephysicallayer,thatis,thestartandendoftheframecanbedistinguishedfromthebitstream.Thisistheproblemofframesynchronization.problem.
(1)Bytecountingmethod:Thisisaframesynchronizationmethodthatusesaspecialcharactertoindicatethebeginningofaframeandaspecialfieldtoindicatethenumberofbytesintheframe.Thereceivercandistinguishthestartoftheframefromthebitstreambyrecognizingthespecialcharacterandknowthenumberofdatabytesthatfollowintheframefromthespecialfield,sothattheendpositionoftheframecanbedetermined.ThetypicalrepresentativeofthesynchronizationprotocolforbytecountingistheDigitalDataCommunicationsMessageProtocol(DDCMP)ofDEC.
ThecontrolcharacterSOHmarksthebeginningofthedataframe.Inactualtransmission,twoormoresynchronizationcharactersareusedtodeterminethestartofaframebeforeSOH.Sometimes,theheadoftheframeisallowedtofollowtheendofthepreviousframe.Atthistime,thereisnoneedtoaddsynchronizationcharactersbetweenthetwoframes..Thecountfieldhasatotalof14bitstoindicatethenumberofbytesofdatainthedatasegmentintheframe.Themaximumvalueofthe14-bitbinarynumberis16383,sothemaximumdatalengthis131064.TheDDCMPprotocolreliesonthisbytecounttodeterminetheendpositionoftheframe.TheACK,SEG,ADDR,andthe2ndbitsCRC1andCRC2intheDDCMPframeformatintheFLAGperformdoublecheckontheheaderpartandthedatapartrespectively.ThereasonfortheseparatecheckoftheheaderpartisemphasizedthatoncetheCONUTfieldintheheaderpartiswrong,Whichlosesthebasisofframeboundarydivision.Sincetheuseofcharactercountingmethodtodeterminetheendoftheframewillnotcauseconfusionofdataandotherinformation,datatransparencycanbeachievedwithoutanymeasures(thatis,anydatacanbetransmittedwithoutrestriction).
(2)Thefirstandlastdelimitermethodusingcharacterpadding:Thismethodusessomespecificcharacterstodelimitthestartandendofaframe,inordertopreventthespecificcharactersfromappearinginthedatainformationbitThesamecharacterismisjudgedasthebeginningandenddelimiteroftheframe.Anescapecontrolcharacter(DLE)canbefilledinfrontofthisdatacharactertoshowthedifference,soastoachievedatatransparency.However,thismethodismoretroublesometouse,andthespecificcharactersusedareexcessivelydependentonthecharacterencodingsetused,andthecompatibilityisrelativelypoor.
(3)Head-to-tailmarkingmethodusingbitstuffing:Thismethodusesasetofspecificbitpatternstomarkthestartandendofaframe.
(4)Illegalcodingmethod:Thismethodisusedwhenthephysicallayeradoptsaspecificbitcodingmethod.Forexample,amethodcalledManchesterencodingistoencodethedatabit"1"intoa"high-low"levelpair,andthedatabit"0"intoa"low-high"levelpair.The"high-high"levelpairandthe"low-low"levelpairareillegalindatabits.Theseillegalcodingsequencescanbeusedtodelimitthestartandendoftheframe.ThismethodisadoptedintheIEEE802standardforlocalareanetworks.Theillegalcodingmethoddoesnotrequireanyfillingtechnologytoachievedatatransparency,butitisonlysuitableforspecialcodingenvironmentsthatuseredundantcoding.DuetothefragilityoftheCOUNTfieldinthebytecountingmethodandthecomplexityandincompatibilityofthecharacterpaddingmethod,themorecommonlyusedframesynchronizationmethodisthebitpaddingandillegalencodingmethod.
Errorcontrol
Apracticalcommunicationsystemmusthavetheabilitytodetect(ie,detect)sucherrors,andtakecertainmeasurestocorrectthem,sothattheerrorscanbecontrolledwithintheallowableThisistheerrorcontrolprocessandoneofthemainfunctionsofthedatalinklayer.Theerrorcode(suchasparitycheckcode,checksumorCRC)canbecheckedtodeterminewhetheranerrorhasoccurredduringthetransmissionofaframe.Onceanerrorisfound,itcangenerallybecorrectedbyfeedbackretransmission.Thisrequiresthereceivertofeedbackamessagetothesenderwhetherthereceptioniscorrectafterreceivingaframe,sothatthesendercanmakeadecisionwhetheritdoesnotneedtobere-sent,thatis,thesenderwillonlyreceivethemessagethatthereceiverhasreceivedcorrectly.Onlyafterthefeedbacksignalcanitbeconsideredthattheframehasbeencorrectlysent,otherwiseitneedstobere-sentuntilitiscorrect.Thesuddennoiseofthephysicalchannelmaycompletely"overwhelm"aframe,thatis,theentiredataframeorthefeedbackinformationframeislost,whichwillcausethesendertoneverreceivethefeedbackinformationfromthereceiver,whichwillcausethetransmissionprocesstostall.InordertoavoidWhenthishappens,atimerisusuallyintroducedtolimitthetimeintervalforthereceivertosendbackfeedbackinformation.Whenthesendersendsaframe,thetimerisalsostarted.Ifthereceiverfailstoreceivethefeedbackwithinthelimitedtimeinterval.Thefeedbackinformation,thatis,thetimerexpires(Timeout),itcanbeconsideredthatthetransmittedframehasbeenerroneousorlost,andthenitneedstoberesent.Becausethesameframeofdatamayberepeatedlysentmultipletimes.Inordertopreventthisdanger,youcanusethemethodofnumberingthesentframes,thatis,assigningasignaltoeachframe,sothatthereceivercandistinguishfromthesequencenumberwhetheritisanewlysentframeoraframethathasbeenreceivedbutsentagain.,Inordertodeterminewhethertosubmitthereceivedframetothenetworklayer.Thedatalinklayerusescountersandsequencenumberstoensurethateachframeisfinallydeliveredtothetargetnetworklayercorrectly.
Flowcontrol
Flowcontrolisnotauniquefunctionofthedatalinklayer.Manyhigh-levelprotocolsalsoprovideflowtimingcontrolfunctions,buttheobjectsofflowcontrolaredifferent.Forexample,forthedatalinklayer,itcontrolsthetrafficonthedatalinkbetweentwoadjacentnodes,whileforthetransportlayer,itcontrolsthetrafficfromthesourcetothefinaldestination.Duetothedifferencebetweentheworkingspeedoftheequipmentusedbythesendingandreceivingpartiesandthebufferstoragespace,thesendingcapacityofthesendermaybegreaterthanthereceivingcapacityofthereceiver.Withproperrestriction,theframesthatweretoolatetobereceivedinthefrontwillbe"overwhelmed"bytheframesthatarecontinuouslysentintheback,resultinginthelossofframesanderrors.Itcanbeseenthatflowcontrolisactuallythecontrolofthedataflowofthesendersothatthesendingratedoesnotexceedtheabilityofthereceiver.Thisprocessrequiresacertainfeedbackmechanismtoletthesenderknowwhetherthereceivercankeepupwiththesender,thatis,thereneedtobesomerulessothatthesenderknowsunderwhatcircumstancesitcancontinuetosendthenextframe,andunderwhatcircumstancesmustbesuspended.,Inordertowaitforreceivingsomekindoffeedbackinformationtocontinuesending.
LinkManagement
Thelinkmanagementfunctionismainlyusedforconnection-orientedservices.Beforethenodesatbothendsofthelinkwanttocommunicate,theymustfirstconfirmthattheotherpartyisinareadystate,andexchangesomenecessaryinformationtoinitializetheframesequencenumber,andthentheconnectioncanbeestablished,andtheconnectionmustbemaintainedduringthetransmissionprocess.Ifthereisanerror,itneedstobere-initializedandtheconnectionisautomaticallyestablishedagain.Afterthetransmissioniscompleted,theconnectionmustbereleased.Theestablishment,maintenanceandreleaseofdatalinklayerconnectionsiscalledlinkmanagement.Whenmultiplesitessharethesamephysicalchannel(forexample,inaLAN),howtoallocateandmanagechannelsamongsitesthatrequirecommunicationalsobelongstothecategoryofdatalinklayermanagement.
Relatedprotocols
Thedatalinkcontrolprotocolisalsocalledthelinkcommunicationprotocol,whichisthedatalinklayerprotocolintheOSIreferencemodel.Linkcontrolprotocolscanbedividedintotwocategories:asynchronousprotocolsandsynchronousprotocols.
Themainprotocolsofthedatalinklayerare:
(1) Point-ad-PointProtocol (Point-ad-PointProtocol);
(2) Ethernet(Ethernet);
(3) Maximum-LevelDataLinkProtocol;
(4) FrameRelay;
(5) AsynchronousTransferMode;
Asynchronousprotocol
Thecharacterisanindependentinformationtransmissionunit,andthecharacterisstartedatthebeginningofeachcharacter.Thebitswithinaresynchronized,buttheintervalbetweencharactersisnotfixed(thatis,thecharactersareasynchronous).Sincethetwoagreedclocksofthetransmitterandreceiver,whichareapproximatelythesamefrequency,canbesynchronizedinarelativelyshortperiodoftime,theclocksynchronizedatthebeginningofthecharactercanbeusedtosampleeachbitinthecharacterwithouttheneedEachbitissynchronizedbyothermethods.Intheasynchronousprotocol,redundantbitssuchasstartbit,paritybit,andstopbitareaddedtoeachtransmissioncharacter,sothechannelutilizationisverylow,anditisgenerallyusedforoccasionswithlowdatarates.
Synchronisationprotocol
Synchronisationprotocolisadatablockorganizedbymanycharactersormanybits—frameasthetransmissionunit,synchronizedatthebeginningoftheframe,sothattheframeiskeptfixedClock.Infact,thefixedclockismixedinthedataandsentoutbythesendingendthroughacertaintechnology,sothatthereceivingendcanseparatetheclockfromtheinputdata.Itismorecomplicatedtoimplement.Thisfunctionisusuallyperformedbythedemodulator.Finish.Becausetheframeisusedasthetransmissionunit,thesynchronizationprotocolcanmakemoreeffectiveuseofthechannel,anditisalsoconvenienttoimplementfunctionssuchaserrorcontrolandflowcontrol.Thesynchronizationprotocolcanbedividedintothreetypes:character-orientedsynchronizationprotocol,bit-orientedsynchronizationprotocolandbytecounting-orientedsynchronizationprotocol.
HDLC
HDLCisageneraldatalinkcontrolprotocol.Whenadatalinkisestablished,aspecificoperationmodeisallowed.Theso-calledlinkoperationmode,inlayman'sterms,referstotheoperationofacertainstationasamasterstation,orasaslavestation,orboth.Thestationusedtocontrolthedestinationonthelinkiscalledthemasterstation,andotherstationscontrolledbythemasterstationarecalledslavestations.Themasterstationisresponsiblefororganizingthedataflowandrecoveringfromerrorsonthelink.Theframesentbythemasterstationtotheslavestationiscalledthecommandframe,andtheframereturnedbythestationtothemasterstationiscalledtheresponseframe.Linkswithmultiplestationsusuallyusepollingtechnology.Thestationthatpollsotherstationsiscalledthemasterstation,andeachstationinthepoint-to-pointlinkcanbethemasterstation.Themasterstationneedsmorelogicfunctionsthantheslavestation,sowhentheterminalisconnectedtothehost,thehostisalwaysthemasterstation.
Modeofoperation
TherearethreecommonlyusedmodesofoperationinHDLC:
(1)NormalresponsemodeNRMisanunbalanceddatalinkoperationMode,sometimescallednon-balancednormalresponsemode.Thismodeofoperationissuitableforterminal-orientedpoint-to-pointorpoint-to-multipointlinks.Inthismodeofoperation,thetransmissionprocessisinitiatedbythemasterstation,andtheslavestationcanonlytransmitinformationtothemasterstationasaresponseafterreceivingacertaincommandframefromthemasterstation.Theresponsemessagecanconsistofoneormoreframes.Ifthemessageconsistsofmultipleframes,itshouldindicatewhichoneisthelastframe.Themasterstationisresponsibleformanagingtheentirelink,andhastherighttopoll,selectslavestations,andsendcommandstotheslavestations.Itisalsoresponsibleforthecontroloftimeout,retransmissionandvariousrecoveryoperations.
(2)AsynchronousresponsemodeARM,whichisalsoanunbalanceddatalinkoperationmode.UnlikeNRM,thetransmissionprocessofARMisinitiatedbytheslavestation.Theoneoragroupofframesthattheslavestationactivelysendstothemasterstationmaycontaininformation,oritmaybeaframesentonlyforthepurposeofcontrol.Inthismodeofoperation,theslavestationcontrolsthetimeoutandretransmission.Thismethodisindispensableforthemulti-stationlotusroadthatadoptsthepollingmethod.TheARMoperationmodeisshowninFigure3.7(b).
(3)AsynchronousbalancemodeABM.AsynchronousbalancemodeABMisanoperationmodethatallowsanynodetostarttransmission.Inordertoimprovelinktransmissionefficiency,ahigheramountofinformationtransmissionisrequiredbetweennodesinbothdirections.Inthismodeofoperation,anystationcanstartthetransmissionoperationatanytime,andeachstationcanbeusedasbothamasterstationandaslavestation,andeachstationisacombinedstation.Eachstationhasthesamesetofprotocols,anystationcansendorreceivecommands,andcanalsogivearesponse,andeachstationhasthesameresponsibilityfortheerrorrecoveryprocess.
Frameformat
InHDLC,dataandcontrolmessagesaretransmittedinastandardframeformat.TheframeinHDLCissimilartothecharacterblockofBSC,butthedatamessageandcontrolmessageintheBSCprotocolaretransmittedindependently,andthecommandinHDLCshouldbetransmittedinaunifiedformataccordingtotheframe.ThecompleteframeofHDLCiscomposedofflagfield(F),addressfield(A),controlfield(C),informationfield(I),framechecksequencefield(FCS),etc.
(1)Flagfield(F):Theflagfieldisabitpatternof01111110,whichisusedtomarkthestartoftheframeandtheendofthepreviousframe.Theflagfieldcanalsobeusedasapaddingcharacterbetweenframes.Usually,atthemomentwhentheframeisnotbeingtransmitted,thechannelisstillintheactivestate.Inthisstate,thesendercontinuouslysendstheflagfield,anditcanbeconsideredthatanewframetransmissionhasstarted.The"0bitinsertionmethod"canbeusedtoachievetransparenttransmissionof0data.
(2)Addressfield(A):Thecontentoftheaddressfielddependsontheoperationmodeused.Intheoperationmode,therearemasterstations,slavestations,andcombinedstations.Eachslavestationandcombinationstationisassignedauniqueaddress.Theaddressfieldinthecommandframecarriestheaddressoftheoppositestation,andtheaddresscarriedintheaddressfieldintheresponseframeistheaddressoftheownstation.Anaddresscanalsobeassignedtomorethanonestation.Thistypeofaddressiscalledagroupaddress.Framestransmittedusingagroupaddresscanbereceivedbyallstationsinthegroupthatownthegroup.Butwhenastationorcombinedstationsendsaresponse,itshouldstilluseitsuniqueaddress.Itisalsopossibletouseall"1"addressestoindicateaddressesthatincludeallstations,calledbroadcastaddresses,andframescontainingbroadcastaddressesaretransmittedtoallstationsonthelink.Inaddition,italsostipulatesthatall"0"addressesarenon-stationaddresses.Thistypeofaddressisnotallocatedtoanystationandisonlyusedfortesting.
(3)Controlfield(C):Thecontrolfieldisusedtoformvariouscommandsandresponsestomonitorandcontrolthelink.Thesendermasterstationorcombinationstationusesthecontrolfieldtonotifytheaddressedslavestationorcombinationstationtoperformtheagreedoperation;onthecontrary,theslavestationusesthisfieldasaresponsetothecommandandreportsthecompletedoperationorstatuschange.ThisfieldisthekeytoHDLC.Thefirstorfirstandsecondbitsinthecontrolfieldindicatethetypeoftransmissionframe.TherearethreedifferenttypesofframesinHDLC:informationframe(Iframe),monitoringframe(Sframe)andunnumberedframe(Uframe).ThefifthbitofthecontrolfieldistheP/Fbit,thatis,thePoll/Finalbit.
(4)Informationfield(I):Theinformationfieldcanbeanybinarybitstring.Thelengthofthebitstringisnotlimited.TheupperlimitisdeterminedbytheFCSfieldorthebuffercapacityofthecommunicationstation.1000~2000bitsaremorecommonlyusedinternationally;thelowerlimitcanbe0,thatis,noinformationfield.However,themonitoringframe(Sframe)stipulatesthattheremustnotbeaninformationfield.
(5)Framechecksequencefield(FCS):Theframechecksequencefieldcanuse16-bitCRCtocheckthecontentoftheentireframebetweenthetwoflagfields.
Frametype
HDLChasthreedifferenttypesofframes: informationframe(Iframe),monitoringframe(Sframe)andunnumberedframe(Uframe).
(1)Informationframe(Iframe):Informationframeisusedtotransmitvalidinformationordata,usuallyreferredtoasIframe.TheIframeismarkedbythefirstbitofthecontrolwordas"0".TheN(S)inthecontrolfieldoftheinformationframeisusedtostorethesequencenumberofthesendingframe,sothatthesenderdoesnothavetowaitforconfirmationtosendmultipleframescontinuously.N(R)isusedtostorethesequencenumberofthenextframethatthereceiverexpectstoreceive,N(R)=5,whichmeansthatthereceiverwillreceiveframe5inthenextframe,inotherwords,theframesbeforeframe5arereceived.
(2)Monitoringframe(Sframe):Monitoringframeisusedforerrorcontrolandflowcontrol,usuallyreferredtoasSframe.TheSframeismarkedwith"10"asthefirstandsecondbitsofthecontrolfield.TheSframehasaninformationfieldandhasonly6bytes,thatis,48bits.ThethirdandfourthbitsofthecontrolfieldoftheSframeareSframetypecodes.Therearefourdifferentcodes,whichrespectivelyindicate:
00——ReceiveReady(RR),whichissentbythemasterstationortheslavestation.ThemasterstationcanusetheRRtypeSframetopolltheslavestation.TheslavestationtransmitsanIframenumberedN(R).Ifsuchaframeexists,itwilltransmit;theslavestationcanalsorespondwithanRRtypeSframe,whichmeansThenumberofthenextIframethattheslavehopestoreceivefromthemasterisN(R).
01——Reject(REJ),sentbythemasterstationortheslavestationtorequestthesendertoretransmittheframestartingfromthenumberN(R)andallsubsequentframes,thisItalsoimpliesthatIframesbeforeN(R)havebeenreceivedcorrectly.
10 ————————————————————————————————————————— , id est Iframe cum innumeris quam N(R) acceptis, butitis inabusystate, anditis non prompte recipere Iframe with numberN(R)Fames, which canbeused to controllinkflow.
11--Rejectio(SREJ), whichrequiresthesendertosendasingleIframenumberedN(R), andimplies that allIframesofitsnumber confirmatus est.
(3).Innumerata frame (Uframe): innumerata framegetsit nomen, quia moderatio campi non continet numeros N(S) et N(R), sed ad rationem Uframe. M1, M2, M2, M2, M2, M2, functiones possunt, sed functiones sunt definitae.
Logicallinkcontrollayer
Inthelogicallinkcontrolsublayer,weperformastoporwaitforautomaticrepeatretrieval(ARQ)protocoltodetecterrorsandrequestretransmissionoferrorframes.ThesourcenodeAwaitsforanacknowledgement(ACK)fromthetargetnodeBbeforesendingthenextframeofdata.Ifthereceiptisnotreceivedwithinthepresetpausetime,Aretransmitsthisframeofdata.Duringthetimeperiodwhenthedataframetravelsbackandforth,thechannelremainsidle.Inafull-duplexcommunicationlink,ifnodeAcontinuouslytransmitsthesamedataframewhilewaitingforanACK,thenetworkthroughputcanbeincreased.
TheDLSLlayersubsystemscanbedividedinto:DLSLinitializationmodule,DLSLstatemachinemodule,DLSLdataservicemodule,DLSLmanagementservicemodule,DLSLprocessingMAClayermessagemodule,communicationschedulingmodule,channelfrequencyhoppingModulesandsecuritymodules.
MediaAccessControlSublayer
ThemostcriticaltechnologyofthedatalinklayerisMediaAccessControl(MAC).Itsfunctionistoevenlydistributechannelresourcesamongcompetingandhigh-throughputnodes.Themultipleaccesswithcollisionavoidance(MACA)protocolusestwosignalframescalledrequest/send(RTS)andclear/send(CTS)todetectcollisions.ItisacommonlyusedprotocolintheMACsublayer.WhenthesourcenodeAwantstosendinformationtothetargetnodeB,itwillfirstissueanRTScommand.IfNodeBreceivesRTS,itwillsendbackaCTScommand.IfnodeAdoesnotreceivetheCTSwithinthepredeterminedtime,itwillresendtheRTS.AssoonasnodeAreceivestheCTS,itimmediatelystartstotransmitdataframes.AnyothernodethatlistenstotheCTSwilldelayapacketlengthtoavoidcollisions.
MACAWprotocolisanimprovedversionofMACAprotocol,whichimprovestheperformanceandreliabilityofUAN.
TheMAClayersubsystemcanbedividedinto:MAClayerinitializationmodule,MAClayerstatemachinemodule,MAClayerdataservicefunctionmodule,MAClayermanagementservicefunctionmodule,MAClayerprocessingRFmessagemodule,timeSlotprocessingmoduleandtimesynchronizationmodule.