From: Francis Dupont Date: Fri, 17 Jul 2020 10:56:16 +0000 (+0200) Subject: [#1329] Added UML files X-Git-Tag: Kea-1.8.0~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=16970da27e836797d10bcc887ce056f6fab4cd9c;p=thirdparty%2Fkea.git [#1329] Added UML files --- diff --git a/doc/devel/images/main-loop.png b/doc/devel/images/main-loop.png new file mode 100644 index 0000000000..aec13f41c5 Binary files /dev/null and b/doc/devel/images/main-loop.png differ diff --git a/doc/devel/images/main-loop.svg b/doc/devel/images/main-loop.svg new file mode 100644 index 0000000000..2c1ec0d549 --- /dev/null +++ b/doc/devel/images/main-loop.svg @@ -0,0 +1,97 @@ +DHCP server main loopMain LoopEvent LoopWait for next eventCheck ShutdownTimeoutSignalHandle SignalExternal SocketHandle External SocketDHCP QueryProcess QueryI/O ServiceExecute ready handlerget next eventtimeout expiredno ready handler \ No newline at end of file diff --git a/doc/devel/images/main-loop.uml b/doc/devel/images/main-loop.uml new file mode 100644 index 0000000000..8d47aa9b5b --- /dev/null +++ b/doc/devel/images/main-loop.uml @@ -0,0 +1,58 @@ +@startuml + +title DHCP server main loop + +skinparam linetype ortho + +rectangle "Main Loop" { + agent "Wait for next event" as run + + rectangle "Event Loop" as run_one { + together { + agent "Signal" as signal + + agent "Handle Signal" as handleSignal + } + + together { + agent "External Socket" as external_socket + + agent "Handle External Socket" as handleExternalSocket + } + + together { + agent "DHCP Query" as query + + agent "Process Query" as processQuery + } + + agent "Timeout" as timeout + } + + together { + agent "I/O Service" as poll + + agent "Execute ready handler" as ready + } + + agent "Check Shutdown" as shutdown +} + +run --> run_one : get next event +run_one --> signal +signal -right-> handleSignal : got signal +handleSignal --> poll +signal -[dashed]-> external_socket +external_socket -right-> handleExternalSocket : external socket ready +handleExternalSocket --> poll +external_socket -[dashed]-> query +query -right-> processQuery : DHCP socket ready +processQuery --> poll +query -[dashed]-> timeout +timeout --> poll : timeout expired +poll -> ready : handler ready +poll ---> shutdown : no ready handler +ready -> ready : execute ready handler +shutdown -u-> run + +@enduml \ No newline at end of file diff --git a/doc/devel/images/packet4.png b/doc/devel/images/packet4.png new file mode 100644 index 0000000000..e391a261f5 Binary files /dev/null and b/doc/devel/images/packet4.png differ diff --git a/doc/devel/images/packet4.svg b/doc/devel/images/packet4.svg new file mode 100644 index 0000000000..976ee32fcf --- /dev/null +++ b/doc/devel/images/packet4.svg @@ -0,0 +1,149 @@ +DHCPv4 packet processingProcess Query on its Message TypeProcess DiscoverProcess RequestProcess ReleaseProcess DeclineProcess InformReceive queryinputService EnabledCallout buffer4_receivehookUnpack queryClassify queryCallout pkt4_receivehookCheck DROP classCallout lease4_committedhookParkCallout pkt4_sendSend responsePack responseCallout buffer4_sendoutputDrop packeterrorservice is enabledservice is disabledCONTINUESKIPDROPon errorCONTINUEDROPquery in DROP classunknown message typeon erroron erroron erroron erroron errorCONTINUEDROPPARKunparkCONTINUESKIPDROPCONTINUEDROP \ No newline at end of file diff --git a/doc/devel/images/packet4.uml b/doc/devel/images/packet4.uml new file mode 100644 index 0000000000..a631acca78 --- /dev/null +++ b/doc/devel/images/packet4.uml @@ -0,0 +1,84 @@ +@startuml + +title DHCPv4 packet processing + +agent "Receive query" as receivePacket +note left : input + +agent "Service Enabled" as isServiceEnabled + +agent "Callout buffer4_receive" as buffer4_receive +note right : hook + +agent "Unpack query" as unpack + +agent "Classify query" as classify + +agent "Callout pkt4_receive" as pkt4_receive +note right : hook + +agent "Check DROP class" as drop_class + +rectangle "Process Query on its Message Type" as process { + agent "Process Discover" as processDiscover + agent "Process Request" as processRequest + agent "Process Release" as processRelease + agent "Process Decline" as processDecline + agent "Process Inform" as processInform +} + +agent "Callout lease4_committed" as lease4_committed +note right : hook + +agent "Park" as park + +agent "Callout pkt4_send" as pkt4_send + +agent "Send response" as send + +agent "Pack response" as pack + +agent "Callout buffer4_send" as buffer4_send + +agent "Send response" as send +note left : output + +agent "Drop packet" as drop +note left : error + +receivePacket --> isServiceEnabled +isServiceEnabled --> buffer4_receive : service is enabled +isServiceEnabled ----> drop : service is disabled +buffer4_receive --> unpack : CONTINUE +buffer4_receive --> classify : SKIP +buffer4_receive ----> drop : DROP +unpack --> classify +unpack ---> drop : on error +classify --> pkt4_receive +pkt4_receive --> drop_class : CONTINUE +pkt4_receive ---> drop : DROP +drop_class --> process +drop_class ---> drop : query in DROP class +process ---> drop : unknown message type +processDiscover --> lease4_committed +processDiscover ---> drop : on error +processRequest --> lease4_committed +processRequest ---> drop : on error +processRelease --> lease4_committed +processRelease ---> drop : on error +processDecline --> lease4_committed +processDecline ---> drop : on error +processInform --> lease4_committed +processInform ---> drop : on error +lease4_committed --> pkt4_send : CONTINUE +lease4_committed ---> drop : DROP +lease4_committed --> park : PARK +park -[dashed]-> pkt4_send : unpark +pkt4_send --> pack : CONTINUE +pkt4_send --> buffer4_send : SKIP +pkt4_send ---> drop : DROP +pack --> buffer4_send +buffer4_send --> send : CONTINUE +buffer4_send ---> drop : DROP +send -[hidden]-> drop +@enduml \ No newline at end of file diff --git a/doc/devel/images/request4.png b/doc/devel/images/request4.png new file mode 100644 index 0000000000..eb9b6e2050 Binary files /dev/null and b/doc/devel/images/request4.png differ diff --git a/doc/devel/images/request4.svg b/doc/devel/images/request4.svg new file mode 100644 index 0000000000..c4abc7ac81 --- /dev/null +++ b/doc/devel/images/request4.svg @@ -0,0 +1,107 @@ +DHCPREQUEST processingA lease was assignedAdd reserved classesClassify required classesBuild configured option listAppend requested optionsAppend requested vendor optionsAppend basic optionsSet fixed fieldsEntry pointSelect subnethook pointFind host reservationAdd either KNOWN or UNKNOWN classClassify (2nd pass)Process client nameAssign a leaseAdjust interface dataAppend server IDon success exit pointReturn no responseon error exit pointhook set DROPDHCPACKDHCPNAKon error \ No newline at end of file diff --git a/doc/devel/images/request4.uml b/doc/devel/images/request4.uml new file mode 100644 index 0000000000..b07929cc92 --- /dev/null +++ b/doc/devel/images/request4.uml @@ -0,0 +1,59 @@ +@startuml + +title DHCPREQUEST processing + +agent "Entry point" as entry + +agent "Select subnet" as selectSubnet +note right : hook point + +agent "Find host reservation" as findReservation + +agent "Add either KNOWN or UNKNOWN class" as known + +agent "Classify (2nd pass)" as classify2 + +agent "Process client name" as processClientName + +agent "Assign a lease" as assignLease + +rectangle "A lease was assigned" as ack { + agent "Add reserved classes" as setReservedClasses + agent "Classify required classes" as requiredClassify + agent "Build configured option list" as buildCfgOptionList + agent "Append requested options" as appendRequestedOptions + agent "Append requested vendor options" as appendRequestedVendorOptions + agent "Append basic options" as appendBasicOptions + agent "Set fixed fields" as setFixedFields +} + +agent "Adjust interface data" as common + +agent "Append server ID" as appendServerID +note left : on success exit point + +agent "Return no response" as drop +note left : on error exit point + +entry --> selectSubnet +selectSubnet --> findReservation +selectSubnet ---> drop : hook set DROP +findReservation --> known +known --> classify2 +classify2 --> processClientName +processClientName --> assignLease +assignLease --> ack : DHCPACK +assignLease --> common : DHCPNAK +assignLease ---> drop : on error +ack --> setReservedClasses +setReservedClasses --> requiredClassify +requiredClassify --> buildCfgOptionList +buildCfgOptionList --> appendRequestedOptions +appendRequestedOptions --> appendRequestedVendorOptions +appendRequestedVendorOptions --> appendBasicOptions +appendBasicOptions --> setFixedFields +setFixedFields --> common +common --> appendServerID +appendServerID -[hidden]-> drop + +@enduml \ No newline at end of file diff --git a/doc/devel/images/select4.png b/doc/devel/images/select4.png new file mode 100644 index 0000000000..c5697e24c4 Binary files /dev/null and b/doc/devel/images/select4.png differ diff --git a/doc/devel/images/select4.svg b/doc/devel/images/select4.svg new file mode 100644 index 0000000000..957938379d --- /dev/null +++ b/doc/devel/images/select4.svg @@ -0,0 +1,152 @@ +DHCPv4 subnet selectionRelayedSet address for lookupTry incoming interfaceTry addressRelay address matches subnetRelay address matches shared networkCheck client classSet relay addressSet client addressSet source addressInterface matches subnetInterface atches shared networkCheck client classSet interface addressCheck subnet prefixCheck client classEntry pointTry RAI link selectFound a subnetFound no subnetCallout subnet4_selectReturn a subnetReturn no subnetDrop queryrelayednot relayedno matchmatchno matchmatchcompatiblenot compatibletry the relay addreesshas no relay addresshas no client addrssno suitable addresshas a relay addresshas a client addresshas source addess and use unicastno interfacematchno matchmarchno matchcompatiblenot compatiblehas an interface addressno interface addressmatchno matchcompatiblenot compatibleCONTINUE and subnet setSKIP or subnet not setDROP \ No newline at end of file diff --git a/doc/devel/images/select4.uml b/doc/devel/images/select4.uml new file mode 100644 index 0000000000..2e54f97d95 --- /dev/null +++ b/doc/devel/images/select4.uml @@ -0,0 +1,82 @@ +@startuml + +title DHCPv4 subnet selection + +agent "Entry point" as entry + +agent "Try RAI link select" as rai_link_select + +rectangle "Relayed" as relayed { + agent "Relay address matches subnet" as relay_subnet + agent "Relay address matches shared network" as relay_network + agent "Check client class" as relay_class +} + +rectangle "Set address for lookup" as set_address { + agent "Set relay address" as relay_address + agent "Set client address" as client_address + agent "Set source address" as source_address +} + +rectangle "Try incoming interface" as interface { + agent "Interface matches subnet" as interface_subnet + agent "Interface atches shared network" as interface_network + agent "Check client class" as interface_class + agent "Set interface address" as interface_address +} + +rectangle "Try address" as address { + agent "Check subnet prefix" as inRange + agent "Check client class" as address_class +} + +agent "Found a subnet" as found + +agent "Found no subnet" as not_found + +agent "Callout subnet4_select" as subnet4_select + +agent "Return a subnet" as success + +agent "Return no subnet" as no_subnet + +agent "Drop query" as drop + +entry --> rai_link_select +rai_link_select --> relayed : relayed +rai_link_select --> set_address : not relayed +relayed --> relay_subnet +relay_subnet --> relay_network : no match +relay_subnet --> relay_class : match +relay_network --> set_address : no match +relay_network --> relay_class : match +relay_class ---> found : compatible +relay_class --> set_address : not compatible +set_address --> relay_address : try the relay addreess +relay_address -r-> client_address : has no relay address +client_address -r-> source_address : has no client addrss +source_address --> interface_subnet : no suitable address +relay_address --> inRange : has a relay address +client_address --> inRange : has a client address +source_address --> inRange : has source addess and use unicast +interface_subnet ---> not_found : no interface +interface_subnet --> interface_class : match +interface_subnet --> interface_network : no match +interface_network --> interface_class : march +interface_network ---> not_found : no match +interface_class ---> found : compatible +interface_class ---> interface_address : not compatible +interface_address --> inRange : has an interface address +interface_address ---> not_found : no interface address +inRange ---> address_class : match +inRange ---> not_found : no match +address_class ---> found : compatible +address_class ---> not_found : not compatible +found --> subnet4_select +not_found --> subnet4_select +found -[hidden]> not_found +subnet4_select --> success : CONTINUE and subnet set +subnet4_select --> no_subnet : SKIP or subnet not set +subnet4_select --> drop : DROP + +@endutl