DOC

File

By Rhonda Marshall,2014-07-23 21:10
6 views 0
File

    File

Vo1.16No.3JournalofSouthwestJiaotongUniversity(EnglishEdition)Ju1.2008

    ;ArticleID:1005-2429(2008)03-0214-08

    ;FileTransferAlgorithmforAutonomousDecentralizedSystem ;GUIXun(桂勋),TANYongdong(谭永东)

    ;SchoolofElectricalEngineering,SouthwestJiaotongUnive~i@, ;QianQingquan(钱清泉)

    ;Chengdu610031,China

    ;Abstract

    ;AfiletransferalgorithmbasedonADP(autonomousdecentralizedprotoco1)waspropose

    dtosolvetheproblemthattheADS

    ;(autonomousdecentralizedsystem)middleware(NeXUS/Drink)lacksoffiletransferfun

    ctionsforWindows.Thealgorithm

    ;realizesthepeer-topeerfiletransfer,onetoNinquiry/multiresponsefiletransferandonetoNfiledistributioninthesamedata

    ;fieldbasedoncommunicationpatternsprovidedbytheADP.Thepeer-topeerfiletransfe

    risimplementedthroughapeer-topeer

    ;communicationpath,onetoNinquiry/multiresponsefiletransferandonetoN

    filedistributionareimplementedthroughmulticast ;communication.Inthisalgorithm,afiletobetransferredisnamedwithaGUID(globaluniq

    ueidentification),everydatapacketis

    ;markedwithasequencenumber,andfilereceivinginparallelisimplementedbycachingDPOs(dataprocessingobjects)andmulti

    ;threadtechnologies.Thealgorithmisappliedinasimulationsystemofthedecentralizedco

    ntrolplatform,andthetestresultsand

    ;longtimestablerunningprovethefeasibilityofthealgorithm. ;KeywordsADS;ADP;Filetransferalgorithm;NeXUS/Dlink ;Introduction

    ;ADP(autonomousdecentralizedprotoco1)

    ;wasproposedbyMSTC,Japan,andimplementedby

    ;HITACHIcompanyastheproductofNeXUS/Drink,

    ;whosecommunicationmodelistheadvaneedPl/S

    ;(publish/subscribe)andprovidesmulticastandpeer

    ;topeerbasecommunicationsbaseduponTCPand

    ;UDP.NetworkapplicationsthatuseADPprotocol

    ;caneasilyrealizesuchexcellentcharacteristicsason

    ;linemaintainability,onlineexpandability,andfault

    ;tolerance,anddecreasethecomplexityofdesignand ;Received20o71221

    ;FoundationitsTheNationalInnovationFund

    ;(No.00(2262251211336);theProjectofStateKeyLaboratory ;ofRailTrafficControlandSafety,BeijingJiaotongUniversity ;(No.SL2007K001)

    ;BiographyGbqXun(1978),PhDcandidate.Hisre.

    ;searchinterestisinautonomousdecentralizedsystemandits ;application

    ;$Correspondingauthor.Te1.:+86-28-87600331;Email:

    ;guintd@263.net

    ;programmmg?

    ;Filetransferprotocolsareveryimportantforde

    ;centralizedsystemsandnetworkapplicationsto ;exchangefiles.Generally,TCPisadoptedtorealize ;filetransferalgorithm[.,.becauseitisareliable

    ;peertopeercommunicationprotoco1.HoweverIPad

    ;dressesandcommunicationportsarebandedinapro

    ;gram,whichunderminestheonlineexpandabilityof

    ;applications.Sofartheseparatefiletransferalgorithm ;andAPIhavebeendevelopedforNeXUS/Dlinkljfor ;Unix,butnotforWindows.Thefiletransferalgo

    ;rithmrealizedinUnixusespeer??to??peercommunica?? ;tionmethodstotransferlargefilesandusesmulticast ;methodstodistributelargefiles,whichisverycon

    ;venientforthedeveloperswhouseNeXUS/Dlinkin ;Unixtorealizethefunctionoffiletransfer,butthose ;whouseNeXUS/D1inkforWindowshavetouseFTP ;orotherfiletransferprotocols,whichisdifficultand ;inconvenientfordevelopersandunderminesthe ;expandabilityofapplications.Tosolvetheabove ;problemwedevelopanewfiletransferalgorithmand ;

    ;GUIXuneta1./FileTransferAlgorithmforAutonomousDecentralizedSystem215

    ;APIsbasedonADP,whichsuitsbothWindOWSand ;Unix,toimprovetheexpandabifityofappfications. ;Developerscaneasilyusethealgorithmtorealize ;large--filetransferbypeer-to??peercommunication

    ;methodsormulticastcommunicationmethods. ;Thealgorithmhasbeensuccessfullyusedinthe ;simulationsystemofthedecentralizedcontrolplat

    ;formwithdynamicevolutiontowardsrailwaytrans

    ;portationsystem’.j.whichmeetsthedemandoffre—

    ;quentparallelfiletransferinthesimulationsystem. ;1IntroductiontoADS

    ;TheADS(autonomousdecentralizedsys

    ;tem)Iv-n]iscomposedofmanyautonomoussubsys

;temsthathavetwoproperties:

    ;Autonomouscontrollability:ifanysubsystem ;fails,theothersubsystemscancontinuetomanage ;themselves.

    ;Autonomouscoordinabilit),:ifanysubsystem

     ;fails,theothersubsystemscancoordinatetheirindi

    ;vidualobjectivesamongthemselves.

    ;Thesetwopropertiesassuresuchcharacteristics ;asonlineexpansion,faulttoleranceandonline

    ;maintenanceforthesystem.

    ;TherearefourlevelsinADSarchitectureasfol

    ;lows.

    ;Logicalnode(LN):anLNisthemostfunction

    ;alunitinADS.Withinadatafield,anumber ;uniquelyidentifiesalogicalnode.whichiscalleda ;logicalnodenumber(LNN).

    ;Datafield(DF):aDFisaplacethroughwhich ;specificdatapassinADS.MUldplenodesbelongtoa ;DFtosendorreceivedata.ADFcorrespondstothe ;transmissionnetworkormemoryinphysicalconcept. ;Multicastgroup(MCG):anMCGisagroupof ;nodesbelongingtoaDFtodeterminewhetherto ;receivedatabroadcastedfromacomputer.Muldple ;multicastgroupsconstituteadatafieldUsually,mul

    ;ticastgroupsareassignedforeachjobexecutedcoop

    ;erativelybetweennodesinthesamedatafield.Multi

    ;castgroupsexecuteautonomousjobs.

    ;Domain:adomainisdefinedastheconcept ;abovethedatafield.Generallyeachdomai4ais ;definedasalocalsite,andconnectedwithother ;domainsthroughwideareacommunicationnetworks. ;TheconceptofdomaincorrespondstoanLAN(1ocal ;areanetwork).

    ;Therelationsbetweenlogicalnodes,datafields, ;multicastgroupsanddomainsareshowninFig.1. ;Fig.1StructureofADS

    ;AnADSisdrivenbytransactions.Atransaction ;meanstoprocessconcerningproducts,services,or ;realtimeevents.Inadecentralizedtransaction ;process,transactionsareprocessedinadecentralized ;systemconsistingofmultiplecomputers.Alltransac

    ;tionsareassignedtransactioncodes(TCDs)toidenti

    ;fythem.ATCDrepresentstransactiondata.Each ;applicationprogramspecifiesaTCDtosenddatato

    ;theremotenodeorreceiveincomingdataatthelocal ;node.AuniqueTCDmustbedefinedforeachdata ;field.

    ;2AlgorithmDesign

    ;2.1Generaldescriptionofthealgorithm ;Decentralizedfiletransferisapartofdecentral

    ;izedsystem.Decentralizedsystemsareoftenrequired ;totransmitfilesbetweenoneandothernodesordis ;tributefiletomullenodes,andanodemayinquire

    ;otheron’finenodestosendspecifiedfilestoit.File

    ;transferisnecessaryforADS.AnADPisbasedon ;theautonomousdecentralizedconcept.Itprovides ;fourcommunicationpatterns~peer--to--peerinquiry/ ;

    ;216JournalofSouthwestJiaotongUniversity(EnglishEdition)

    ;singleresponsecommunication,multicastinquiry/ ;singleresponsecommunication,multicastinquiry/

    responsecommunicationandonetoNinquiry/ ;multi

    ;multiresponsecommunication.Withthesefourcorn

    ;municationpatterns,thefollowingfiletransferpat

    ;ternscanbeimplemented:peertopeerfiletransfer,

    ;onetoNinquiry/multiresponsefiletransferandone

    ;to,Nfiledistribution.

    ;Inordertoidentifydifferentpacketsfromdiffer- ;entnodes,everyfileisnamedwithaGUID(Global ;UniqueIdentification),andtheGUIDisassignedto ;everypacketofthefile.Similarly,inordertoidenti

    ;fydifferentpacketsofthesanlefilefromthesame ;sourcenode,asequencenumberisassignedtoevery ;filedatapacket.Receivingnodeassemblespackets ;accordingtoGUIDsandsequencenumbers. ;Becausemulticastcommunicationisnotreliable, ;retransmissionmechanismmustbeavailable.Apro

    ;graminreceivingnodereceivesthemulticastdataand ;checksthesequencenumbersassignedtothepackets ;toseewhethertheyareinaproperorder.Ifso,the ;programassemblesthepacketsintoafile.Ifitfindsa ;2.3

    ;r……………………………

    ;;SendingnodewithspecificTCDi

    ;Thesendingprocessworksinabackstagethread, ;whichdividesafileintosmallpackets.Each ;packetisassignedwithaGUID,afilenalne,a ;sequencenumber,areceivenodenumber,etc.,

;andsenttothedestinationnode.

    ;i

    ;瞄冀i罄嚣剿臻黼iil;鬣鹾援鞭墓冀熏曩

    ;missingnumber,itnotifiesaprograminthesending ;node.Whennotified,theprograminthesending ;nodestartsretransmissionofthemissingpacket. ;Whenallpacketshavebeensenttodestinationnodes ;successfully,aspecialmessageissenttothereceiving ;node,calledanendingmessage,andthesequence ;numberofthelastpacketisreported.Furthermore,in ;thereceivingnodetheprogramcheckschecksumof

    ;everypackettoseewhetherithasbeendestroyed.If ;so.theretransmissionmechanismwilibestarted. ;2.2Peertopeerfiletransfer

    ;Peer..to..peerfiletransferishighlyreliable.Itis ;implementedthroughapeer._to..peercommunication ;path.Datatransmittedaresubjectedtocycficredun

    topeerfiletransfercanbe ;dancycheck(cRc).Peer

    ;performedinoneoftwomodes.InPUTmode.afile ;inthelocalnodeistransferredtotheremotenode.In ;GETmode.afileintheremotenodeistransferredto ;thelocalnodebyinformationreceiredfromlocal ;node.Fig.2showstheworkingflowinpeertopeer

    ;fi1etransfer.

    ;-…—--_-----_…—------…—------_-…—--_------ ;Receivingnode;

    ;DPO(dataprocessingobject)handlepacket ;t

    ;ISearchorcreateDPObyGUIDinthe

    ;Ireceivedpacket.I

    ;t

    ;}l_薯辫?l)p0黧囊0ll

    ;Fig.2Fileuans~rinpeer-topeercommunication

    ;One--to--Ninquiry/multi--responsefile ;transfer

    ;One--to--Ninquiry/multi--responsefiletransferis ;basedonmulticastcommunication.Ifanodewantsto ;getfiles,itlaunchesabackstagethreadtonotifyother ;onlinenodeswithaTRREQUIREFILETCD,

    ;eachofthenodeswhichhavereceivedtheinquiry ;launchesabackstagethreadtosearchthefiles.Ifthe ;backstagethreadfindsoutafilesuccessfully,itdi

    ;ridesthefileintosmallpartsandsendstothereceiv

    ;ingnode.

;

    ;GUIXunet./FileTransferAlgorithmforAutonomousDecentralizedStg

    ;BecauseonetoNinquiry/multiresponsefile

    ;transferisbasedonmulticastcommunication,files ;canbegotfrommultiplenodessimultaneouslyinan ;efficientmanner.Toassuretheprocess,theretrans

    ;2l7

    ;missionmechanismmustbeavailable.TKsmecha- ;nismreceivesaresponsethroughpeer-to--peercomInu-

    ;nicationandretransmitsdataonlytothenodesthatdid ;notrespondwith.Fig.3showstheworkingflow. ;Fig.3One-tONinquiry/multiresponsefiletransferinmulticastcommunication

    ;2.4One.tc}-Nfiledistribution

    ;0netoNfiledistributionisbasedonmulticast ;communication.Inthisway,afilecanbedistributed ;fromonenodetomultiplenodesbymulticasttrans- ;mission.Transmissionischeckedtoseewhetherthe ;filehasarrivedatthedestinationnodesinpeer-to-peer ;communication.Ifaspecifiednodedidnotreceive ;filesduetocommunicationerror,filetransmis~onto ;thenodeiscanceled,butthatbetweenthesource ;nodeandnormaldestinationnodescontinues. ;Becauseone.toNmedistributionconductsthe

    ;multicastcommunicationinthesamewayasone?to--N ;inquiry/multi-responsefiletrmisferdoes,re~ansmis

    ;sionmechanismmustbeavai1ab1e.Anodereceivesa ;responsethroughpeertopeercommunicationandre

    ;transmitsdataonlytothenodesthatdidnotrespond ;TheworkingflowisshowedinFig.4.

    ;Fig.4Oneto-Nfiledistributioninmulticastcommunication ;

    ;218

    ;3

    ;JournalofSouthwestJiaotongUniversity(EnglishEdition) ;ImplementationofFileTransfer

    ;Algorithm

    ;3.1Requirementsonthealgorithm

    ;Inthesendingalgorithm,thetransferredattrib- ;utes(pathname,userID,andgroupID)areneces. ;saryforfilecreationontheremotenode.Whatalsois ;requiredaresendingcommunicationattributes(priori- ;tylevelandtransfertimeout)inAPIarguments.The ;userCanalsospecifywhethertoreportanotifymes- ;sagetoanapplicationwhenthefiletransferis

    ;completedandtheentirefileiswrittentodiskonthe ;remotenode.Iftimeoutisencountered,theprocess ;ofreceivingafileiscanceled,andthecreatedfileis ;deleted.Torealizethoseflexiblefiletransferpa~ems, ;twoTCDsaredefinedinthealgorithm.Table.1 ;showsthedescriptionsofthetwoTCDs.

    ;Table1TCDsdefinedinalgorithm

    ETCDt0 ;AnodesendsaTRREOU琢匹F

    ;otheron-linenodestogetspecifiedfiles,andthe ;nodesthathavereceivedtheTCDsearchthefilesin ;theirlocalpaths.Thespecifiedfilesaresenttothe ;nodethathassentouttherequirementifthefilesare ;found.ATR_

    ;TRAN_

    ;FILETCDsuggeststhatthere-

    ;ceivedpacketisthepacketofmedata.andthepacket ;ischeckedandsaved.

    ;3.2Filesendingalgorithm

    ;Thefile-sendingalgorithmworkswithaback- ;stagethreadtoavoiddisturbancesonothernormal ;workduringtheprocessofsendingfile. ;Therearethreedatastructuresinthealgorithmas ;listedbelow.

    ;typedefstruct_

    ;gui_

    ;disffile_

    ;header

    ;{

    ;GUIDMAPGUID;#GUIDassignedtOfile

    ;intnode;//nodenumber

    ;charfilename[256];#filename

    ;charnodename[256];#nodenarne

    ;unsignedlonguserID;#userID

    ;unsignedlonggroupID;#groupID

    ;unsignedlongdwAttributes;#fileattributes ;unsignedlongdwFileLength;#filesize ;}gui_distfile_header;

    ;typedefstruct_

    ;gni_

    ;distfile

    ;{

    ;GUIDMAPGUID;#GUIDassignedtOfile

    ;inttranNumber;//transfersequencenumber ;inttrueSize:?realvafiddatasizeinTransferBuf

    ;charTransferBuf[5120];#filedatabuffer ;unsignedlongnCheck;#check-sum

    ;}gni_distfile;

    ;typedefstruct_

    ;gui_

    ;distfile_

    ;end

    ;{

    ;GUIDMAPGUID;#GUIDassignedtofile ;intnode;#nodenumber

    ;charfilename[256];#filename

    ;charnodename[256];#nodename

    ;unsignedlongdwFileLength;

    ;intlastSequenceNum;#the

    ;lastdatapacket

    ;f7filesize

    ;sequencenumberof

    ;}gui_distfile_end;

    ;Fig.5showstheworkingflowofthefile-sending ;algorithm.Thegui

    ;distfile

    ;headerstructureisthe

    ;Fig.5Workingflowoffile-sendingalgorithm ;

    ;GU1Xuneta1./FileTransferAlgorithmforAutonomousDecentralizedm

    ;f’rvstpacketsenttothereceivingnode.Filedataisin

    ;structuregui

    ;distf’lle.Thegui—

    ;distfile_

    ;endissentout

    ;ifthedataofafilehavebeensenttothedestination ;nodecorrectly.

    ;Thefilesendingbackstagethreadisasleepafter ;thefiledatahavebeensentout.Theinterfaceofthe ;backstagethreadisdefinedasthefollowingclass. ;classCThreadTranFile’

    ;{

    ;‘public:

    ;CadTraIlFile();

    ;protected:

    ;intm_nCurBlock;//currentsequencenumber ;intm_

    ;nTransHandle;//communicationhandle ;FILE$mTranFile;

;gui_

    ;distfiledistblock;

    ;2

    ;gui_

    ;distfile__

    ;headerdistStart;

    ;gui_

    ;distfileenddistend;

    ;charlocalNodeName[256];//localnodenalne

    ;protected:

    ;virtualCThreadTranFile();

    ;voidOnRequestStartTransfile(); ;voidOnRequesetTansNextBlock(); ;voidOnRequestRetmnBlock(); ;3.3File-receivingalgorithm ;Fig.6showstheworkingflowofthefilereceiv

    ;ingalgorithm.TheinterfacefunctionsofDPOareto

    ;saveandmanagepackets,andtheDPOnotifiesthe

    ;sendingnodetoretransmitthepacketiftheDPOfinds

    ;thepacketdestroyedorlost. ;GU?>16UID1l?——

    ;‘fTm’I

    ;.

    ;PacketGUID3tanuenleIRegisteranewDPOinreceivingn0de.

    ;I

    ;GU?>2….DPO

    ;processespacket,!lOpenafileandgetafilehandle.

    ;IPacketandcheckssequence ;numberandcheck-sum.

    ;一一一Jr

    ;IGUID3tedatat.filebythe.penedhandle. ;1Packet

    ;‘,

    ;

    ;EndT

    ;

    ;rans

    ;_11

    ;File[cl0se

    ;n1c

    ;the

    ;c

    ;opene

    ;p0nd

;dfil

    ;in

    ;eh

    ;g

    ;an

    ;res0

    ;dle

    ;?ce.

    ;andclear

    ;?

    ;\

    ;Fig.6Workingflowoffilereceivingalgorithm

    ;Thefilereceivingalgorithmabstractsallthe ;operationsonfilesavingasanobject:DPO(data ;processingobject).ADPOisuniquelymarkedby ;GUIDofthefilesentfromasourcenode.Once ;createdsuccessfullyinreceivingnode,theDPOis ;storedincachememoryasalist.TheDPOcanbe ;accesseddirectlyiftheretransmissionofthesamefile ;isrequired.

    ;Inthereceivingnode,asearchingalgorithm ;worksonthebasisoftheDPOsregisteredinthenode ;byGUIDofthereceivingpacket.Ifthereistheright ;DPOthathasthesameGUID,theDPOprocessesthe ;packet.Otherwise,itisobviousthatthefiledatain ;thedatapackisnew,andaDPOcorrespondingwith ;misfileiscreatedautomaticallyandregisteredinthe ;systemaccordingtotheGUIDofthepacket.The ;DPOinterfaceisdefinedasinthefollowingclass. ;classCFileDataManager

    ;{

    ;public:

    ;virtualCFileDataManager();

    ;CFileDataManager();

    ;voidStartGetFile(intnNode,stringstrNodeName, ;stringstrFileName,unsignedlongnFileLength, ;GUIDFILEGUID);//startreceivingfiledata ;protected:

    ;boolWriteBuffer(intnCurNumber,charpBuf,int ;nLength);//writedataintofile

    ;boolEndTransFile();//finishfiletransmission ;boolDirectorylsExist(stringstrPath);#checkpath ;boolCheckReceivedPacket();//checkpacket ;

Report this document

For any questions or suggestions please email
cust-service@docsford.com