RFC768J.PostelISI28August1980UserDatagramProtocol----------------------Introduction----------------序言ThisUserDatagramProtocol(UDP)isdefinedtomakeavailableadatagrammodeofpacket-switchedcomputercommunicationintheenvironmentofaninterconnectedsetofcomputernetworks.ThisprotocolassumesthattheInternetProtocol(IP)[1]isusedastheunderlyingprotocol.这个用户数据报协议(UDP)定义了在一个相互连接的计算机网络的环境中包交换计算机通信模式的一个可用的数据报.此协议把互联网协议(IP)[1]作为它的下层协议.Thisprotocolprovidesaprocedureforapplicationprogramstosendmessagestootherprogramswithaminimumofprotocolmechanism.Theprotocolistransactionoriented,anddeliveryandduplicateprotectionarenotguaranteed.ApplicationsrequiringorderedreliabledeliveryofstreamsofdatashouldusetheTransmissionControlProtocol(TCP)[2].此协议为应用程序提供一个发送消息到其它拥有最小的协议机制程序的过程.此协议是面向处理以及传输和复制保护是无法保证的协议。如果应用程序要求数据流有可靠的传输,那么就应该使用传输控制协议(TCP)[2].Format------格式0781516232431+------------+----------+-----------+----------+|Source|Destination||Port|Port|+------------+----------+-----------+----------+||||Length|Checksum|+------------+-----------+-----------+----------+||dataoctets...+----------------...UserDatagramHeaderFormat0781516232431+--------+--------+--------+--------+|源端口|目的端口||||+--------+--------+--------+--------+||||长度|校验和|+--------+--------+--------+--------+||字节数据+----------------...用户数据报报头格式Fields------各域SourcePortisanoptionalfield,whenmeaningful,itindicatestheportofthesendingprocess,andmaybeassumedtobetheporttowhichareplyshouldbeaddressedintheabsenceofanyotherinformation.Ifnotused,avalueofzeroisinserted.源端口域是一个可选域,当该域有值时,其值表示发送程序的端口,如果不有任何其它信息时,可以假设把一个答复填入该域中.如果该域不使用,那么该域插入0值.Postel[page1]28Aug1980UserDatagramProtocolRFC768FieldsDestinationPorthasameaningwithinthecontextofaparticularinternetdestinationaddress.目的端口域意为着在数据报中有一个特别的互联网目的地址。Lengthisthelengthinoctetsofthisuserdatagramincludingthisheaderandthedata.(Thismeanstheminimumvalueofthelengthiseight.)长度域是此用户数据报的字节长度,此长度包含此数据报的报头和数据两部分.(这意为着此数据报的最小长度是8个字节。)Checksumisthe16-bitone'scomplementoftheone'scomplementsumofapseudoheaderofinformationfromtheIPheader,theUDPheader,andthedata,paddedwithzerooctetsattheend(ifnecessary)tomakeamultipleoftwooctets.校验和域是来自IP报头和UDP报头信息的一个伪头部的反码运算求和的16位反码,在UDP报头中,数据部分要用0值个字节填充结束(如果有必要的话)以使数据是16位的倍数。ThepseudoheaderconceptuallyprefixedtotheUDPheadercontainsthesourceaddress,thedestinationaddress,theprotocol,andtheUDPlength.Thisinformationgivesprotectionagainstmisrouteddatagrams.ThischecksumprocedureisthesameasisusedinTCP.伪头部实际上不存在的,其是概念性的加在UDP头部的最前面,其包含源地址,目的地址,协议,和UDP长度。这个信息保证了数据报正确路由。这个校验和过程也同样在TCP中使用。0781516232431+--------+--------+--------+--------+|sourceaddress|+--------+--------+--------+--------+|destinationaddress|+--------+--------+--------+--------+|zero|protocol|UDPlength|+--------+--------+--------+--------+0781516232431+--------+--------+--------+--------+|源地址|+--------+--------+--------+--------+|目的地址|+--------+--------+--------+--------+|零|协议|UDP长度|+--------+--------+--------+--------+Ifthecomputedchecksumiszero,itistransmittedasallones(theequivalentinone'scomplementarithmetic).Anallzerotransmittedchecksumvaluemeansthatthetransmittergeneratednochecksum(fordebuggingorforhigherlevelprotocolsthatdon'tcare).如果计算出来的校验和是零的话,此校验和以全1的值被传输(等于用反码运算表示)。一个全零的可传输的校验和值意为它的传送者没有产生校验和(对于调试或更高层的协议不必关注)。UserInterface--------------用户界面Auserinterfaceshouldallowthecreationofnewreceiveports,receiveoperations,onthereceiveportsthatreturnthedataoctetsandanindicationofsourceportandsourceaddress,andanoperationthatallowsadatagramtobesent,specifyingthedata,sourceanddestinationportsandaddressestobesent.一个用户界面应该可以创建新的接收端口,在返回字节数据和一个指示源端口和源地址的接收端口上接收操作,允许发送一个数据报的操作,也允许发送指定的数据,源和目的端口和地址。[page2]Postel28Aug1980RFC768UserDatagramProtocolIPInterfaceIPInterface-------------IP界面TheUDPmodulemustbeabletodeterminethesourceanddestinationinternetaddressesandtheprotocolfieldfromtheinternetheader.OnepossibleUDP/IPinterfacewouldreturnthewholeinternetdatagramincludingalloftheinternetheaderinresponsetoareceiveoperation.SuchaninterfacewouldalsoallowtheUDPtopassafullinternetdatagramcompletewithheadertotheIPtosend.TheIPwouldverifycertainfieldsforconsistencyandcomputetheinternetheaderchecksum.此UDP模块必须能够从Internet报头确定源和目的Internet地址以及协议域。一个可有的UDP/IP界面可以返回一个完整的Internet数据报,其包含全部的Internet报头响应一个接收操作。这样一个界面也允许UDP传递一个完整的连IP题头的Internet数据报.此IP将为一致性而检验某些域和计算Internet报头的校验和。ProtocolApplication--------------------协议应用ThemajorusesofthisprotocolistheInternetNameServer[3],andtheTrivialFileTransfer[4].此协议的主要使用是Internet名字服务器[3]和简单文件传输[4]。ProtocolNumber---------------协议号Thisisprotocol17(21octal)whenusedintheInternetProtocol.Otherprotocolnumbersarelistedin[5].当在IP中使用此协议时,此协议号是17(八进制数为21)。其它协议号都列在[5]中。References----------[1]Postel,J.,InternetProtocol,RFC760,USC/InformationSciencesInstitute,January1980.[2]Postel,J.,TransmissionControlProtocol,RFC761,USC/InformationSciencesInstitute,January1980.[3]Postel,J.,InternetNameServer,USC/InformationSciencesInstitute,IEN116,August1979.[4]Sollins,K.,TheTFTPProtocol,MassachusettsInstituteofTechnology,IEN133,January1980.[5]Postel,J.,AssignedNumbers,USC/InformationSciencesInstit