libxipc_overview.tex
来自「BCAST Implementation for NS2」· TEX 代码 · 共 304 行
TEX
304 行
\documentclass[11pt]{article}\usepackage{times}\usepackage{amsmath}\usepackage{graphicx}\usepackage{rotating}\usepackage{fullpage}\newcommand{\eg}{\emph{e.g.\/}} % e.g.\newcommand{\ie}{\emph{i.e.\/}} % i.e.\title{XORP Inter-Process Communication Library Overview \\\vspace{1ex} Version 0.5}\author{ XORP Project \\ International Computer Science Institute \\ Berkeley, CA 94704, USA \\ {\it feedback@xorp.org}}\date{November 6, 2003}\begin{document}\maketitle\begin{abstract}Extensibility and robustness are key goals of the eXtensible OpenRouter Project (XORP). A step towards satisfying both of these goalsis to separate the functional components of a router into independenttasks and to execute each of these tasks as separate processes. Froman extensibility perspective this allows components of the router tobe started, stopped, and exchanged dynamically, and to be distributedacross a number of hosts. From a robusness perspective, the processesare afforded the protection mechanisms afforded by modern operatingsystems so a failure of one routing task does not necessarily bringthe router to a halt. The routing tasks do need to communicate and wehave developed an asynchronous remote procedure call mechanism that iscapable of working with multiple transport protocols between remotehosts and can leverage existing IPC mechanisms within a singlehost. This document discusses aspects of the design and the directionsit may take in future.\end{abstract}\section{Introduction}Robustness and extensibility are two of the goals of the XORP project.One way a router can achieve robustness is to run routing protocols inprotected environments, such as separate userland processes on amodern operating system. And one way a router can achieveextensibility is to be independent of the details about where thoserouting processes are running and what the composition of theforwarding plane is. The routing processes and network interfacescould be running on one machine or distributed across a cluster ofmachines that appear as single router. A necessary feature oncerouting protocols are running in distinct processes and potentially ondistinct machines is an inter-process communication mechanism. Incontrast to traditional inter-process communication schemes, thescheme employed in the XORP project can utilize multiple transportprotocols and potentially communicate with unmodified componentsthrough these protocols, for instance SNMP or HTTP.The lofty goals of XORP's Inter-Process Communication (XIPC) scheme are:\begin{itemize}\item to provide all of the IPC communication mechanisms that a router islikely to need, \eg sockets, ioctl's, System V messages, shared memory.\item to provide a consistent and transparent interface irrespectiveof the underlying transport mechanism used.\item to transparently select the appropriate IPC mechanism whenalternatives exist.\item to provide an asynchronous interface.\item to be efficient.\item to potentially wrapper communication with non-XORP processes,\eg HTTP and SNMP servers.\item to be renderable in human readable form so XORP processes canread and write commands from configuration files.\end{itemize}The XIPC goals are realized through XORP Resource Locators (XRLs) andthe XORP IPC (XIPC) library. XRLs are responsible for describing aninter-process calls and their arguments. An XRL may be represented inhuman readable form that allows for easy manipulation with editingtools and invocation from the command line during development.XORP processes export XRL interfaces to a process known as the {\emFinder} and inform it of which IPC schemes are available to invokeeach XRL. The Finder is then able to provide a resolution service forXORP processes. When a process needs to dispatch an XRL it firstcontacts the Finder, obtains details on which IPC mechanisms areavailable to contact the process, and then instantiatesa suitable transport.The XIPC library provides the framework for handling and manipulatingXRLs, communicating with the Finder, and common protocol families forconducting IPC. In addition to the XIPC library, an interfacedefinition language exists, together with tools to translate theseinto callable C++ interfaces and into a set of C++ handler routinesfor handling the receipt of XRL calls. These tools are described indocument \cite{xorp:xrl_interfaces}. The tools reduce the amount offamiliarity the working programmer needs to have with the internals ofthe XIPC library. This document provides an overview of the XIPClibrary and is the recommended starting point before using thelibrary.\section{XORP Resource Locators (XRL's)}The mechanism we've settled on for IPC within XORP processes is mediatedthrough \emph{Xorp Resource Locators} (XRL's). An XRL describes aprocedure call. It comprises the protocol family to be used fortransport, the arguments for the protocol family, the interface of thetarget being called and its version, the method, and an argumentlist. Examples of XRLs in their human readable forms are shown infigure \ref{fig:human-readable}. The existence of a human readableform for XRLs is chiefly a convenience for humans who need to workwith XRLs and not indicative of how they work internally.Resolved and unresolved forms of the same are XRL are depicted infigure \ref{fig:human-readable}. The unresolved form is the startingpoint for the majority of inter-process communication. In theunresolved form the protocol family is set to ``finder'' and theprotocol parameters set to the target name that the XRL call isintended for. A process wishing to dispatch an XRL for the first timepasses the unresolved XRL to the Finder, which returns the resolvedform with the appropriate protocol family and protocol familyarguments. The finder may also modify the other components of theXRL, but doesn't usually do so. This functionality may be useful whensupporting backwards compatibility of interfaces, \ie the Finder couldmodify the interface number and method name.The resolved forms of XRLs are typically maintained in a client sidecache so the Finder need not be consulted for each XRL dispatch.\clearpage\begin{sidewaysfigure}(a) Unresolved form:\begin{centering}\small\begin{verbatim}finder://fea/fti/0.1/add_route?net:ipv4net=10.0.0.1/8&gateway:ipv4=192.150.187.1+----- +-- +-- +-- +-------- +------------------------------------------------| | | | | || | | | Method Arguments| | | || | | Interface version | | || | Interface Name | | | Protocol Parameters|Protocol Family\end{verbatim}\end{centering}\normalsize(b) Resolved form:\small\begin{verbatim}stcp://192.150.1.5:1992/fti/0.1/add_route?net:ipv4net=10.0.0.1&gateway:ipv4=192.150.1.1+--- +-------------- +-- +-- +-------- +--------------------------------------------| | | | | || | | | Method Arguments| | | || | | Interface version | | || | Interface Name | | | Protocol Parameters|Protocol Family\end{verbatim}\normalsize\caption{\label{fig:human-readable}Human readable XRL forms.}\end{sidewaysfigure}\clearpage\section{XRL Targets and the Finder}An {\em XRL Target} is an entity that is capable of dispatching XRLs.The {\em Finder} is the entity in XIPC system that knows about XRLTargets and is responsible for directing IPC communication between XRLTargets. The IPC communication schemes that XRL Targets use tocommunicate XRLs between each other once they have been resolved bythe Finder are known as {\em Protocol Families}.Each XRL Target has an associated class name and an instance name.Class names indicate the functionality that the target implements andthere may be multiple targets in the XIPC system with the same classname. Instance names are unique identifiers for each target in theXIPC system. XRLs to be resolved by the Finder may address a targetby class name or by instance name. The Finder treats the firstinstance in a class as the primary instance of that class and XRLsdirected to a class resolve equivalently to the primary instance.The class of an XRL Target dictates which methods the target supports.Interfaces are collections of XRLs that relate to some aspect offunctionality and objects in a given class implement handlers for oneor more interfaces. Once an XRL Target has registered its presencewith the Finder, it registers the XRLs associated with the interfacesit supports. XRLs are registered one at a time and only when all ofthe XRLs have been registered does the XRL Target become visible tothe outside world through the Finder.The Finder provides a one-to-many mapping service. Each XRL Targetmay specify multiple protocol families for each XRL they export. Whena target requests the resolution of an XRL, the answer will containthe complete list of available resolutions and the resolver can decidewhich it would prefer to use. When registering the target indicatesthe XRL method name and an appropriate protocol family. so targetsthat support multiple protocol families perform a separateregistration each XRL and protocol family pair. This provides aflexible system for implementing optimizations on the level ofindividual XRLs.% When a process starts up, it registers it's XRL targets with the% Finder, and registers the XRLs supported by each target individually.% During registration of an XRL, both the method name and the available% protocol families for executing the XRL are communicated to the% Finder. The first XRL Target instantiated in a particular class is% considered by the Finder to be the primary instance of that class.% When the Finder receives XRLs to resolve that refer to a class name as% a target, it resolves them as if the XRL contained the instance name% of the primary instance in the class. Should the XRL Target% corresponding to the primary instance of a class leave the XRL system,% because of a process exiting or explicit deregistration, then the next% instance of the class that registered with the Finder is used as the% primary instance.There is a slight subtlety with registration for the sake of security.This arises because some of the protocol families that can be used tocommunicate XRLs and responses to XRLs allow for remote access,examples being UDP and TCP protocol families. The source code to theXORP project is publicly available and the XRL interfaces and targetsare included the package. With knowledge of the XRL interfaces andtargets it would be relatively straightforward for external parties toopportunistically dispatch XRLs on a XORP router. However, if XRLcommunication can be coerced to use the Finder, access control can beenforced centrally. To achieve this, the Finder performs XRL methodname transformation. When an XRL is registered with the Finder, theFinder transforms the resolved form of the XRLs method name, andinstructs the registering target to dispatch the transformed name asif it were the original name. The method name transformation isdesigned to be hard to counter and each XRL method is transformeduniquely. The registering process therefore has to maintain a mappingtable from the interface.In addition to handle XRL registrations and resolutions, the Finder iscapable of notifying XRL Targets about events it is aware of, like thebirth and death of other XRL Targets. The Finder exposes an XRLinterface for this purpose and is able to invoke XRLs on XRL Targetsto perform the notification. A special tunneling mechanism exists inthe communication protocol used to communicate with the Finder forthis purpose. The details of this communication will be expanded uponlater on [XXX in a later edit to this document].\section{Components of XRL Framework}\begin{description}\item [XRL] an inter-process call that is transparent to theunderlying transport method.\item [Finder] the process that co-ordinates the resolution of targetnames into a parseable form to find the XRL Protocol Family Listener.\item [XRL Router] an object responsible for sending and receivingXRLs. They manage all the underlying interactions and are theinterface that users are expected to use for XRL interactions.% TODO: the above description of [XRL Router] is unclear.\item [Finder Client] an object associated with an XRL Router thatmanages the communication with the Finder.\item [XRL Protocol Family] a supported transport mechanism for theinvoked XRL.\item [XRL Protocol Family Sender] an entity that dispatches XRLrequests and handles responses. Senders are created based on Finderlookup's of the appropriate communication mechanism.\item [XRL Protocol Family Listener] an entity that listens forincoming requests, dispatches the necessary hook, and sends theresponses. When Listeners are created they register the appropriatemapping with the Finder so that corresponding Senders can beinstantiated to talk with them.\end{description}The kdoc documentation provides details of the particular classes.%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% BIBLIOGRAPHY%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\bibliography{../tex/xorp}\bibliographystyle{plain}\end{document}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?