m ތEc@sdZdklZdefdYZdefdYZdefdYZdefd YZd efd YZd efd YZdefdYZ defdYZ defdYZ defdYZ defdYZ defdYZdefdYZdefdYZdefdYZd efd!YZd"efd#YZd$efd%YZd&efd'YZd(efd)YZd*efd+YZd,efd-YZd.eefd/YZd0efd1YZd2efd3YZd4efd5YZd6efd7YZd8efd9YZd:efd;YZd<efd=YZ d>efd?YZ!d@efdAYZ"dBefdCYZ#dDefdEYZ$dFe$fdGYZ%dHe%fdIYZ&dJe%fdKYZ'dLe$fdMYZ(dNefdOYZ)dPefdQYZ*dRefdSYZ+dTefdUYZ,dVefdWYZ-dXefdYYZ.dZS([sInterface documentation. API Stability: stable, other than IReactorUDP (semi-stable) and IReactorMulticast (unstable). Maintainer: U{Itamar Shtull-Trauring} (s InterfacetIAddresscBstZdZRS(sjAn address, e.g. a TCP (host, port). Default implementations are in L{twisted.internet.address}. (t__name__t __module__t__doc__(((ts/home/radix/Projects/Twisted/branches/releases/twisted-core-2.5.x-2329-2/Twisted.exp/twisted/internet/interfaces.pyRs t IConnectorcBs2tZdZdZdZdZdZRS(smObject used to interface between connections and protocols. Each IConnector manages one connection. cCsdS(sStop attempting to connect.N((((RtstopConnectingscCsdS(sDisconnect regardless of the connection state. If we are connected, disconnect, if we are trying to connect, stop trying. N((((Rt disconnect"scCsdS(s!Try to connect to remote address.N((((Rtconnect)scCsdS(spReturn destination this will try to connect to. @return: An object which provides L{IAddress}. N((((RtgetDestination,s(RRRRRRR (((RRs    tIResolverSimplecBstZddZRS(Niii i-cCsdS(sEResolve the domain name C{name} into an IP address. @type name: C{str} @type timeout: C{tuple} @rtype: L{twisted.internet.defer.Deferred} @return: The callback of the Deferred that is returned will be passed a string that represents the IP address of the specified name, or the errback will be called if the lookup times out. If multiple types of address records are associated with the name, A6 records will be returned in preference to AAAA records, which will be returned in preference to A records. If there are multiple records of the type to be returned, one will be selected at random. @raise twisted.internet.defer.TimeoutError: Raised (asynchronously) if the name cannot be resolved within the specified timeout period. N((tnamettimeout((Rt getHostByName4s(iii i-(RRR (((RR 3st IResolvercBstZddZddZddZddZddZddZddZdd Z dd Z dd Z dd Z dd Z ddZddZddZddZddZddZddZddZddZddZddZRS(Ni cCsdS(sxLookup the records associated with the given name that are of the given type and in the given class. N((R tclsttypeR ((Rt lookupRecordGscCsdS(sYInterpret and dispatch a query object to the appropriate lookup* method. N((tqueryR ((RRLscCsdS(s-Lookup the A records associated with C{name}.N((R R ((Rt lookupAddressQscCsdS(s2Lookup all the A6 records associated with C{name}.N((R R ((RtlookupAddress6TscCsdS(s4Lookup all the AAAA records associated with C{name}.N((R R ((RtlookupIPV6AddressWscCsdS(s.Lookup the MX records associated with C{name}.N((R R ((RtlookupMailExchangeZscCsdS(s2Lookup the the NS records associated with C{name}.N((R R ((RtlookupNameservers]scCsdS(s1Lookup the CNAME records associated with C{name}.N((R R ((RtlookupCanonicalName`scCsdS(s.Lookup the MB records associated with C{name}.N((R R ((Rt lookupMailBoxcscCsdS(s.Lookup the MG records associated with C{name}.N((R R ((RtlookupMailGroupfscCsdS(s.Lookup the MR records associated with C{name}.N((R R ((RtlookupMailRenameiscCsdS(s/Lookup the PTR records associated with C{name}.N((R R ((Rt lookupPointerlscCsdS(s/Lookup the SOA records associated with C{name}.N((R R ((RtlookupAuthorityoscCsdS(s0Lookup the NULL records associated with C{name}.N((R R ((Rt lookupNullrscCsdS(s/Lookup the WKS records associated with C{name}.N((R R ((RtlookupWellKnownServicesuscCsdS(s1Lookup the HINFO records associated with C{name}.N((R R ((RtlookupHostInfoxscCsdS(s1Lookup the MINFO records associated with C{name}.N((R R ((RtlookupMailboxInfo{scCsdS(s/Lookup the TXT records associated with C{name}.N((R R ((Rt lookupText~scCsdS(s.Lookup the RP records associated with C{name}.N((R R ((RtlookupResponsibilityscCsdS(s1Lookup the AFSDB records associated with C{name}.N((R R ((RtlookupAFSDatabasescCsdS(s/Lookup the SRV records associated with C{name}.N((R R ((Rt lookupServicescCsdS(s+Lookup all records associated with C{name}.N((R R ((RtlookupAllRecordsscCsdS(s.Perform a zone transfer for the given C{name}.N((R R ((Rt lookupZones(RRRRRRRRRRRRRRRRRR R!R"R#R$R%R&R'(((RRFs.                      tIReactorArbitrarycBstZdZdZRS(NcOsdS(s8Start an instance of the given C{portType} listening. @type portType: type which implements L{IListeningPort} @param portType: The object given by C{portType(*args, **kw)} will be started listening. @return: an object which provides L{IListeningPort}. N((tportTypetargstkw((Rt listenWiths cOsdS(sU Start an instance of the given C{connectorType} connecting. @type connectorType: type which implements L{IConnector} @param connectorType: The object given by C{connectorType(*args, **kw)} will be started connecting. @return: An object which provides L{IConnector}. N((t connectorTypeR*R+((Rt connectWiths (RRR,R.(((RR(s t IReactorTCPcBs&tZdddZdddZRS(Ni2tcCsdS(sConnects a given protocol factory to the given numeric TCP/IP port. @param port: a port number on which to listen @param factory: a L{twisted.internet.protocol.ServerFactory} instance @param backlog: size of the listen queue @param interface: the hostname to bind to, defaults to '' (all) @return: an object that provides L{IListeningPort}. @raise CannotListenError: as defined here L{twisted.internet.error.CannotListenError}, if it cannot listen on this port (e.g., it cannot bind to the required port number) N((tporttfactorytbacklogt interface((Rt listenTCPsicCsdS(sConnect a TCP client. @param host: a host name @param port: a port number @param factory: a L{twisted.internet.protocol.ClientFactory} instance @param timeout: number of seconds to wait before assuming the connection has failed. @param bindAddress: a (host, port) tuple of local address to bind to, or None. @return: An object which provides L{IConnector}. This connector will call various callbacks on the factory when a connection is made, failed, or lost - see L{ClientFactory} docs for details. N((thostR1R2R t bindAddress((Rt connectTCPs(RRR5tNoneR8(((RR/st IReactorSSLcBs&tZdddZdddZRS(NicCsdS(sMConnect a client Protocol to a remote SSL socket. @param host: a host name @param port: a port number @param factory: a L{twisted.internet.protocol.ClientFactory} instance @param contextFactory: a L{twisted.internet.ssl.ClientContextFactory} object. @param timeout: number of seconds to wait before assuming the connection has failed. @param bindAddress: a (host, port) tuple of local address to bind to, or C{None}. @return: An object which provides L{IConnector}. N((R6R1R2tcontextFactoryR R7((Rt connectSSLsi2R0cCsdS(s Connects a given protocol factory to the given numeric TCP/IP port. The connection is a SSL one, using contexts created by the context factory. @param port: a port number on which to listen @param factory: a L{twisted.internet.protocol.ServerFactory} instance @param contextFactory: a L{twisted.internet.ssl.ContextFactory} instance @param backlog: size of the listen queue @param interface: the hostname to bind to, defaults to '' (all) N((R1R2R;R3R4((Rt listenSSLs(RRR9R<R=(((RR:st IReactorUNIXcBs/tZdZdddZddddZRS(sUNIX socket methods.iicCsdS(sConnect a client protocol to a UNIX socket. @param address: a path to a unix socket on the filesystem. @param factory: a L{twisted.internet.protocol.ClientFactory} instance @param timeout: number of seconds to wait before assuming the connection has failed. @param checkPID: if True, check for a pid file to verify that a server is listening. @return: An object which provides L{IConnector}. N((taddressR2R tcheckPID((Rt connectUNIXsi2icCsdS(sListen on a UNIX socket. @param address: a path to a unix socket on the filesystem. @param factory: a L{twisted.internet.protocol.Factory} instance. @param backlog: number of connections to allow in backlog. @param mode: mode to set on the unix socket. @param wantPID: if True, create a pidfile for the socket. @return: An object which provides L{IListeningPort}. N((R?R2R3tmodetwantPID((Rt listenUNIXs(RRRRARD(((RR>s tIReactorUNIXDatagramcBs/tZdZddedZdddZRS(sdatagram UNIX socket methods.i icCsdS(sConnect a client protocol to a datagram UNIX socket. @param address: a path to a unix socket on the filesystem. @param protocol: a L{twisted.internet.protocol.ConnectedDatagramProtocol} instance @param maxPacketSize: maximum packet size to accept @param mode: mode to set on the unix socket. @param bindAddress: address to bind to @return: An object which provides L{IConnector}. N((R?tprotocolt maxPacketSizeRBR7((RtconnectUNIXDatagram#scCsdS(ssListen on a datagram UNIX socket. @param address: a path to a unix socket on the filesystem. @param protocol: a L{twisted.internet.protocol.DatagramProtocol} instance. @param maxPacketSize: maximum packet size to accept @param mode: mode to set on the unix socket. @return: An object which provides L{IListeningPort}. N((R?RFRGRB((RtlistenUNIXDatagram3s (RRRR9RHRI(((RRE s t IReactorUDPcBs/tZdZdddZddddZRS(sUDP socket methods. IMPORTANT: This is an experimental new interface. It may change without backwards compatability. Suggestions are welcome. R0i cCsdS(sConnects a given DatagramProtocol to the given numeric UDP port. @return: object which provides L{IListeningPort}. N((R1RFR4RG((Rt listenUDPIsicCsdS(sDEPRECATED. Connects a L{twisted.internet.protocol.ConnectedDatagramProtocol} instance to a UDP port. N((t remotehostt remoteportRFt localportR4RG((Rt connectUDPOs(RRRRKRO(((RRJBs tIReactorMulticastcBs tZdZddedZRS(sUDP socket methods that support multicast. IMPORTANT: This is an experimental new interface. It may change without backwards compatability. Suggestions are welcome. R0i cCsdS(sV Connects a given L{DatagramProtocol} to the given numeric UDP port. @param listenMultiple: boolean indicating whether multiple sockets can bind to same UDP port. @returns: An object which provides L{IListeningPort}. N((R1RFR4RGtlistenMultiple((RtlistenMulticast_s (RRRtFalseRR(((RRPXs tIReactorProcesscBs&tZfhddddddZRS(Nic CsdS(s Spawn a process, with a process protocol. @param processProtocol: a L{twisted.internet.protocol.ProcessProtocol} instance @param executable: the file name to spawn - the full path should be used. @param args: the command line arguments to pass to the process; a sequence of strings. The first string should be the executable's name. @param env: the environment variables to pass to the processs; a dictionary of strings. If 'None', use os.environ. @param path: the path to run the subprocess in - defaults to the current directory. @param uid: user ID to run the subprocess as. (Only available on POSIX systems.) @param gid: group ID to run the subprocess as. (Only available on POSIX systems.) @param usePTY: if true, run this process in a pseudo-terminal. optionally a tuple of (masterfd, slavefd, ttyname), in which case use those file descriptors. (Not available on all systems.) @param childFDs: A dictionary mapping file descriptors in the new child process to an integer or to the string 'r' or 'w'. If the value is an integer, it specifies a file descriptor in the parent process which will be mapped to a file descriptor (specified by the key) in the child process. This is useful for things like inetd and shell-like file redirection. If it is the string 'r', a pipe will be created and attached to the child at that file descriptor: the child will be able to write to that file descriptor and the parent will receive read notification via the L{IProcessTransport.childDataReceived} callback. This is useful for the child's stdout and stderr. If it is the string 'w', similar setup to the previous case will occur, with the pipe being readable by the child instead of writeable. The parent process can write to that file descriptor using L{IProcessTransport.writeToChild}. This is useful for the child's stdin. If childFDs is not passed, the default behaviour is to use a mapping that opens the usual stdin/stdout/stderr pipes. @see: L{twisted.internet.protocol.ProcessProtocol} @return: An object which provides L{IProcessTransport}. @raise OSError: Raised with errno EAGAIN or ENOMEM if there are insufficient system resources to create a new process. N(( tprocessProtocolt executableR*tenvtpathtuidtgidtusePTYtchildFDs((Rt spawnProcessos?(RRR9R](((RRTmst IReactorTimecBs)tZdZdZdZdZRS(s2Time methods that a Reactor should implement. cOsdS(s,Call a function later. @type delay: C{float} @param delay: the number of seconds to wait. @param callable: the callable object to call later. @param args: the arguments to call it with. @param kw: the keyword arguments to call it with. @return: An object which provides L{IDelayedCall} and can be used to cancel the scheduled call, by calling its C{cancel()} method. It also may be rescheduled by calling its C{delay()} or C{reset()} methods. N((tdelaytcallableR*R+((Rt callLaterscCsdS(s$This method is deprecated. Cancel a call that would happen later. @param callID: this is an opaque identifier returned from C{callLater} that will be used to cancel a specific call. @raise ValueError: if the callID is not recognized. N((tcallID((RtcancelCallLaters cCsdS(sRetrieve all currently scheduled delayed calls. @return: A tuple of all L{IDelayedCall} providers representing all currently scheduled calls. This is everything that has been returned by C{callLater} but not yet called or canceled. N((((RtgetDelayedCallss(RRRRaRcRd(((RR^s   t IDelayedCallcBs;tZdZdZdZdZdZdZRS(s~A scheduled call. There are probably other useful methods we can add to this interface; suggestions are welcome. cCsdS(siGet time when delayed call will happen. @return: time in seconds since epoch (a float). N((((RtgetTimescCsdS(sCancel the scheduled call. @raises twisted.internet.error.AlreadyCalled: if the call has already happened. @raises twisted.internet.error.AlreadyCancelled: if the call has already been cancelled. N((((RtcancelscCsdS(sIDelay the scheduled call. @param secondsLater: how many seconds from its current firing time to delay @raises twisted.internet.error.AlreadyCalled: if the call has already happened. @raises twisted.internet.error.AlreadyCancelled: if the call has already been cancelled. N((t secondsLater((RR_s cCsdS(sReset the scheduled call's timer. @param secondsFromNow: how many seconds from now it should fire, equivalent to C{.cancel()} and then doing another C{reactor.callLater(secondsLater, ...)} @raises twisted.internet.error.AlreadyCalled: if the call has already happened. @raises twisted.internet.error.AlreadyCancelled: if the call has already been cancelled. N((tsecondsFromNow((Rtresets cCsdS(sx @return: True if this call is still active, False if it has been called or cancelled. N((((Rtactives(RRRRfRgR_RjRk(((RRes   tIReactorThreadscBs)tZdZdZdZdZRS(sxDispatch methods to be run in threads. Internally, this should use a thread pool and dispatch methods to them. cOsdS(s6Run the callable object in a separate thread. N((R`R*tkwargs((Rt callInThreadscOsdS(s Cause a function to be executed by the reactor thread. Use this method when you want to run a function in the reactor's thread from another thread. Calling callFromThread should wake up the main thread (where reactor.run() is executing) and run the given callable in that thread. Obviously, the callable must be thread safe. (If you want to call a function in the next mainloop iteration, but you're in the same thread, use callLater with a delay of 0.) N((R`R*R+((RtcallFromThreads cCsdS(s{ Suggest the size of the internal threadpool used to dispatch functions passed to L{callInThread}. N((tsize((RtsuggestThreadPoolSize%s(RRRRnRoRq(((RRls   t IReactorCorecBsetZdZddZdZdZdZddZdZd Z d Z d Z RS( s0Core methods that a Reactor must implement. i cCsdS(sRReturn a L{twisted.internet.defer.Deferred} that will resolve a hostname. N((R R ((Rtresolve0scCsdS(sFire 'startup' System Events, move the reactor to the 'running' state, then run the main loop until it is stopped with stop() or crash(). N((((Rtrun5scCsdS(s{Fire 'shutdown' System Events, which will move the reactor to the 'stopped' state and cause reactor.run() to exit. N((((Rtstop;scCsdS(sjStop the main loop *immediately*, without firing any system events. This is named as it is because this is an extremely "rude" thing to do; it is possible to lose data and put your system in an inconsistent state by calling this. However, it is necessary, as sometimes a system can become wedged in a pre-shutdown call. N((((Rtcrash?sicCsdS(saRun the main loop's I/O polling function for a period of time. This is most useful in applications where the UI is being drawn "as fast as possible", such as games. All pending L{IDelayedCall}s will be called. The reactor must have been started (via the run() method) prior to any invocations of this method. It must also be stopped manually after the last call to this method (via the stop() method). This method is not re-entrant: you must not call it recursively; in particular, you must not call it while the reactor is running. N((R_((RtiterateHs cCsdS(s|Fire a system-wide event. System-wide events are things like 'startup', 'shutdown', and 'persist'. N((t eventType((RtfireSystemEventVscOsdS(sAdd a function to be called when a system event occurs. Each "system event" in Twisted, such as 'startup', 'shutdown', and 'persist', has 3 phases: 'before', 'during', and 'after' (in that order, of course). These events will be fired internally by the Reactor. An implementor of this interface must only implement those events described here. Callbacks registered for the "before" phase may return either None or a Deferred. The "during" phase will not execute until all of the Deferreds from the "before" phase have fired. Once the "during" phase is running, all of the remaining triggers must execute; their return values must be ignored. @param phase: a time to call the event -- either the string 'before', 'after', or 'during', describing when to call it relative to the event's execution. @param eventType: this is a string describing the type of event. @param callable: the object to call before shutdown. @param args: the arguments to call it with. @param kw: the keyword arguments to call it with. @return: an ID that can be used to remove this call with removeSystemEventTrigger. N((tphaseRxR`R*R+((RtaddSystemEventTrigger]s cCsdS(sRemoves a trigger added with addSystemEventTrigger. @param triggerID: a value returned from addSystemEventTrigger. N((t triggerID((RtremoveSystemEventTriggerscOsdS(sCall a function when the reactor is running. If the reactor has not started, the callable will be scheduled to run when it does start. Otherwise, the callable will be invoked immediately. @param callable: the callable object to call later. @param args: the arguments to call it with. @param kw: the keyword arguments to call it with. @return: None if the callable was invoked, otherwise a system event id for the scheduled call. N((R`R*R+((RtcallWhenRunnings( RRRRsRtRuRvRwRyR{R}R~(((RRr,s       " tIReactorPluggableResolvercBstZdZdZRS(s8A reactor with a pluggable name resolver interface. cCsdS(sSet the internal resolver to use to for name lookups. @type resolver: An object implementing the L{IResolverSimple} interface @param resolver: The new resolver to use. @return: The previously installed resolver. N((tresolver((RtinstallResolvers(RRRR(((RRs t IReactorFDSetcBs;tZdZdZdZdZdZdZRS(s Implement me to be able to use L{FileDescriptor} type resources. This assumes that your main-loop uses UNIX-style numeric file descriptors (or at least similarly opaque IDs returned from a .fileno() method) cCsdS(s,I add reader to the set of file descriptors to get read events for. @param reader: An L{IReadDescriptor} provider that will be checked for read events until it is removed from the reactor with L{removeReader}. @return: C{None}. N((treader((Rt addReaderscCsdS(s.I add writer to the set of file descriptors to get write events for. @param writer: An L{IWriteDescriptor} provider that will be checked for read events until it is removed from the reactor with L{removeWriter}. @return: C{None}. N((twriter((Rt addWriterscCsdS(sYRemoves an object previously added with L{addReader}. @return: C{None}. N((R((Rt removeReaderscCsdS(sYRemoves an object previously added with L{addWriter}. @return: C{None}. N((R((Rt removeWriterscCsdS(sRemove all readers and writers. Should not remove reactor internal reactor connections (like a waker). @return: A list of L{IReadDescriptor} and L{IWriteDescriptor} providers which were removed. N((((Rt removeAlls(RRRRRRRR(((RRs   tIListeningPortcBs)tZdZdZdZdZRS(sA listening port. cCsdS(sStart listening on this port. @raise CannotListenError: If it cannot listen on this port (e.g., it is a TCP port and it cannot bind to the required port number). N((((RtstartListeningscCsdS(sStop listening on this port. If it does not complete immediately, will return Deferred that fires upon completion. N((((Rt stopListeningscCsdS(saGet the host that this port is listening for. @return: An L{IAddress} provider. N((((RtgetHosts(RRRRRR(((RRs   tIFileDescriptorcBs tZdZdZdZRS(sA file descriptor. cCsdS(sn @return: The platform-specified representation of a file-descriptor number. N((((RtfilenoscCsdS(sCalled when the connection was lost. This is called when the connection on a selectable object has been lost. It will be called whether the connection was closed explicitly, an exception occurred in an event handler, or the other end of the connection closed it first. See also L{IHalfCloseableDescriptor} if your descriptor wants to be notified separately of the two halves of the connection being closed. @param reason: A failure instance indicating the reason why the connection was lost. L{error.ConnectionLost} and L{error.ConnectionDone} are of special note, but the failure may be of other classes as well. N((treason((RtconnectionLosts(RRRRR(((RRs  tIReadDescriptorcBstZdZRS(NcCsdS(s?Some data is available for reading on your descriptor. N((((RtdoReads(RRR(((RR stIWriteDescriptorcBstZdZRS(NcCsdS(s5Some data can be written to your descriptor. N((((RtdoWrites(RRR(((RRstIReadWriteDescriptorcBstZdZRS(seI am a L{FileDescriptor} that can both read and write. (RRR(((RRs tIHalfCloseableDescriptorcBs tZdZdZdZRS(s%A descriptor that can be half-closed.cCsdS(s$Indicates write connection was lost.N((R((RtwriteConnectionLost"scCsdS(s#Indicates read connection was lost.N((R((RtreadConnectionLost%s(RRRRR(((RRs  t ISystemHandlecBstZdZdZRS(s5An object that wraps a networking OS-specific handle.cCsdS(sYReturn a system- and reactor-specific handle. This might be a socket.socket() object, or some other type of object, depending on which reactor is being used. Use and manipulate at your own risk. This might be used in cases where you want to set specific options not exposed by the Twisted APIs. N((((Rt getHandle,s (RRRR(((RR)s t IConsumercBs)tZdZdZdZdZRS(s)A consumer consumes data from a producer.cCsdS(sv Register to receive data from a producer. This sets self to be a consumer for a producer. When this object runs out of data (as when a send(2) call on a socket succeeds in moving the last data from a userspace buffer into a kernelspace buffer), it will ask the producer to resumeProducing(). For L{IPullProducer} providers, C{resumeProducing} will be called once each time data is required. For L{IPushProducer} providers, C{pauseProducing} will be called whenever the write buffer fills up and C{resumeProducing} will only be called when it empties. @type producer: L{IProducer} provider @type streaming: C{bool} @param streaming: C{True} if C{producer} provides L{IPushProducer}, C{False} if C{producer} provides L{IPullProducer}. @return: C{None} N((tproducert streaming((RtregisterProducer;scCsdS(sDStop consuming data from a producer, without disconnecting. N((((RtunregisterProducerTscCsdS(s4The producer will write data by calling this method.N((tdata((RtwriteXs(RRRRRR(((RR8s   tIFinishableConsumercBstZdZdZRS(sNA Consumer for producers that finish. This interface is semi-stable. cCsdS(s$The producer has finished producing.N((((Rtfinish`s(RRRR(((RR[s t IProducercBstZdZdZRS(sA producer produces data for a consumer. Typically producing is done by calling the write method of an class implementing L{IConsumer}. cCsdS(sStop producing data. This tells a producer that its consumer has died, so it must stop producing data for good. N((((Rt stopProducingjs(RRRR(((RRcs t IPushProducercBs tZdZdZdZRS(s~ A push producer, also known as a streaming producer is expected to produce (write to this consumer) data on a continous basis, unless it has been paused. A paused push producer will resume producing after its resumeProducing() method is called. For a push producer which is not pauseable, these functions may be noops. This interface is semi-stable. cCsdS(sPause producing data. Tells a producer that it has produced too much data to process for the time being, and to stop until resumeProducing() is called. N((((RtpauseProducing}scCsdS(sResume producing data. This tells a producer to re-add itself to the main loop and produce more data for its consumer. N((((RtresumeProducings(RRRRR(((RRrs  t IPullProducercBstZdZdZRS(s A pull producer, also known as a non-streaming producer, is expected to produce data each time resumeProducing() is called. This interface is semi-stable. cCsdS(sProduce data for the consumer a single time. This tells a producer to produce data for the consumer once (not repeatedly, once only). Typically this will be done by calling the consumer's write() method a single time with produced data. N((((RRs(RRRR(((RRs t IProtocolcBs,tZdZdZdZdZRS(NcCsdS(s=Called whenever data is received. Use this method to translate to a higher-level message. Usually, some callback will be made upon the receipt of each complete protocol message. @param data: a string of indeterminate length. Please keep in mind that you will probably need to buffer some data, as partial (or multiple) protocol messages may be received! I recommend that unit tests for protocols call through to this method with differing chunk sizes, down to one byte at a time. N((R((Rt dataReceiveds cCsdS(sCalled when the connection is shut down. Clear any circular references here, and any external references to this Protocol. The connection has been closed. The C{reason} Failure wraps a L{twisted.internet.error.ConnectionDone} or L{twisted.internet.error.ConnectionLost} instance (or a subclass of one of those). @type reason: L{twisted.python.failure.Failure} N((R((RRs cCsdS(s7Make a connection to a transport and a server. N((t transport((RtmakeConnectionscCsdS(sCalled when a connection is made. This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here. N((((RtconnectionMades (RRRRRR(((RRs  tIHalfCloseableProtocolcBs tZdZdZdZRS(s<Implemented to indicate they want notification of half-closes. TCP supports the notion of half-closing the connection, e.g. closing the write side but still not stopping reading. A protocol that implements this interface will be notified of such events, instead of having connectionLost called. cCsdS(s3Notification of the read connection being closed. This indicates peer did half-close of write side. It is now the responsiblity of the this protocol to call loseConnection(). In addition, the protocol MUST make sure a reference to it still exists (i.e. by doing a callLater with one of its methods, etc.) as the reactor will only have a reference to it if it is writing. If the protocol does not do so, it might get garbage collected without the connectionLost method ever being called. N((((RRs cCsdS(sNotification of the write connection being closed. This will never be called for TCP connections as TCP does not support notification of this type of half-close. N((((RRs(RRRRR(((RRs  tIProtocolFactorycBs)tZdZdZdZdZRS(s&Interface for protocol factories. cCsdS(sCalled when a connection has been established to addr. If None is returned, the connection is assumed to have been refused, and the Port will close the connection. @type addr: (host, port) @param addr: The address of the newly-established connection @return: None if the connection was refused, otherwise an object providing L{IProtocol}. N((taddr((Rt buildProtocols cCsdS(s;Called every time this is connected to a Port or Connector.N((((RtdoStartscCsdS(s?Called every time this is unconnected from a Port or Connector.N((((RtdoStops(RRRRRR(((RRs  t ITransportcBs;tZdZdZdZdZdZdZRS(sI am a transport for bytes. I represent (and wrap) the physical connection and synchronicity of the framework which is talking to the network. I make no representations about whether calls to me will happen immediately or require returning to a control loop, or whether they will happen in the same or another thread. Consider methods of this class (aside from getPeer) to be 'thrown over the wall', to happen at some indeterminate time. cCsdS(sWrite some data to the physical connection, in sequence, in a non-blocking fashion. If possible, make sure that it is all written. No data will ever be lost, although (obviously) the connection may be closed before it all gets through. N((R((RR scCsdS(sWrite a list of strings to the physical connection. If possible, make sure that all of the data is written to the socket at once, without first copying it all into a single string. N((R((Rt writeSequencescCsdS(sClose my connection, after writing all pending data. Note that if there is a registered producer on a transport it will not be closed until the producer has been unregistered. N((((RtloseConnectionscCsdS(s_Get the remote address of this connection. Treat this method with caution. It is the unfortunate result of the CGI and Jabber standards, but should not be considered reliable for the usual host of reasons; port forwarding, proxying, firewalls, IP masquerading, etc. @return: An L{IAddress} provider. N((((RtgetPeer"s cCsdS(s Similar to getPeer, but returns an address describing this side of the connection. @return: An L{IAddress} provider. N((((RR-s(RRRRRRRR(((RRs    t ITCPTransportcBsMtZdZdZdZdZdZdZdZdZ RS(sA TCP based transport.cCsdS(shHalf-close the write side of a TCP connection. If the protocol instance this is attached to provides IHalfCloseableProtocol, it will get notified when the operation is done. When closing write connection, as with loseConnection this will only happen when buffer has emptied and there is no registered producer. N((((RtloseWriteConnection9scCsdS(s!Return if TCP_NODELAY is enabled.N((((Rt getTcpNoDelayCscCsdS(sEnable/disable TCP_NODELAY. Enabling TCP_NODELAY turns off Nagle's algorithm. Small packets are sent sooner, possibly at the expense of overall throughput.N((tenabled((Rt setTcpNoDelayFscCsdS(sReturn if SO_KEEPALIVE enabled.N((((RtgetTcpKeepAliveLscCsdS(sEnable/disable SO_KEEPALIVE. Enabling SO_KEEPALIVE sends packets periodically when the connection is otherwise idle, usually once every two hours. They are intended to allow detection of lost peers in a non-infinite amount of time.N((R((RtsetTcpKeepAliveOscCsdS(sReturns L{IPv4Address}.N((((RRVscCsdS(sReturns L{IPv4Address}.N((((RRYs( RRRRRRRRRR(((RR6s      t ITLSTransportcBstZdZdZRS(sA TCP transport that supports switching to TLS midstream. Once TLS mode is started the transport will implement L{ISSLTransport}. cCsdS(szInitiate TLS negotiation. @param contextFactory: A context factory (see L{ssl.py}) N((R;((RtstartTLScs(RRRR(((RR]s t ISSLTransportcBstZdZdZRS(sA SSL/TLS based transport.cCsdS(s2Return an object with the peer's certificate info.N((((RtgetPeerCertificatels(RRRR(((RRis tIProcessTransportcBsMtZdZdZdZdZdZdZdZdZ RS(sIA process transport. @ivar pid: The Process-ID of this process. cCsdS(s0Close stdin after all data has been written out.N((((Rt closeStdinvscCsdS(s Close stdout.N((((Rt closeStdoutyscCsdS(s Close stderr.N((((Rt closeStderr|scCsdS(s Close a file descriptor which is connected to the child process, identified by its FD in the child process. N((t descriptor((Rt closeChildFDscCsdS(s Similar to L{ITransport.write} but also allows the file descriptor in the child process which will receive the bytes to be specified. This is not available on all platforms. @type childFD: C{int} @param childFD: The file descriptor to which to write. @type data: C{str} @param data: The bytes to write. @return: C{None} N((tchildFDR((Rt writeToChildscCsdS(sClose stdin, stderr and stdout.N((((RRscCsdS(sSend a signal to the process. @param signalID: can be - one of C{"HUP"}, C{"KILL"}, C{"STOP"}, or C{"INT"}. These will be implemented in a cross-platform manner, and so should be used if possible. - an integer, where it represents a POSIX signal ID. @raise twisted.internet.error.ProcessExitedAlready: The process has already exited. N((tsignalID((Rt signalProcesss ( RRRRRRRRRR(((RRps       tIServiceCollectioncBs)tZdZdZdZdZRS(s<An object which provides access to a collection of services.cCsdS(svRetrieve the named service from this application. Raise a KeyError if there is no such service name. N((t serviceName((RtgetServiceNamedscCsdS(s*Add a service to this collection. N((tservice((Rt addServicescCsdS(s&Remove a service from this collection.N((R((Rt removeServices(RRRRRR(((RRs   t IUDPTransportcBs5tZdZedZdZdZdZRS(s$Transport for UDP DatagramProtocols.cCsdS(sWWrite packet to given address. @param addr: a tuple of (ip, port). For connected transports must be the address the transport is connected to, or None. In non-connected mode this is mandatory. @raise twisted.internet.error.MessageLengthError: C{packet} was too long. N((tpacketR((RRs cCsdS(sConnect the transport to an address. This changes it to connected mode. Datagrams can only be sent to this address, and will only be received from this address. In addition the protocol's connectionRefused method might get called if destination is not receiving datagrams. @param host: an IP address, not a domain name ('127.0.0.1', not 'localhost') @param port: port to connect to. N((R6R1((RRs cCsdS(sReturns IPv4Address.N((((RRscCsdS(sStop listening on this port. If it does not complete immediately, will return Deferred that fires upon completion. N((((RRs(RRRR9RRRR(((RRs  tIUDPConnectedTransportcBs tZdZdZdZRS(s7DEPRECATED. Transport for UDP ConnectedPacketProtocols.cCsdS(s,Write packet to address we are connected to.N((R((RRscCsdS(sReturns UNIXAddress.N((((RRs(RRRRR(((RRs  tIUNIXDatagramTransportcBs tZdZdZdZRS(s"Transport for UDP PacketProtocols.cCsdS(sWrite packet to given address.N((RR?((RRscCsdS(sReturns UNIXAddress.N((((RRs(RRRRR(((RRs  tIUNIXDatagramConnectedTransportcBs)tZdZdZdZdZRS(s+Transport for UDP ConnectedPacketProtocols.cCsdS(s,Write packet to address we are connected to.N((R((RRscCsdS(sReturns UNIXAddress.N((((RRscCsdS(sReturns UNIXAddress.N((((RRs(RRRRRR(((RRs   tIMulticastTransportcBs\tZdZdZdZdZdZdZdZddZ dd Z RS( s+Additional functionality for multicast UDP.cCsdS(s/Return interface of outgoing multicast packets.N((((RtgetOutgoingInterfacescCsdS(s\Set interface for outgoing multicast packets. Returns Deferred of success. N((R((RtsetOutgoingInterfacescCsdS(s#Return if loopback mode is enabled.N((((RtgetLoopbackMode scCsdS(s Set if loopback mode is enabled.N((RB((RtsetLoopbackModescCsdS(s'Get time to live for multicast packets.N((((RtgetTTLscCsdS(s&Set time to live on multicast packets.N((tttl((RtsetTTLsR0cCsdS(sJoin a multicast group. Returns Deferred of success or failure. If an error occurs, the returned Deferred will fail with L{error.MulticastJoinError}. N((RR4((Rt joinGroupscCsdS(s2Leave multicast group, return Deferred of success.N((RR4((Rt leaveGroups( RRRRRRRRRRR(((RRs        N(/Rtzope.interfacet InterfaceRRR RR(R/R:R>RERJRPRTR^ReRlRrRRRRRRRRRRRRRRRRRRRRRRRRRRRR(-RPRR(RRRReRRRRRRRRER/RRRRRlRRRR:RRTRRR R>RrRRRRRR^RRRRJRRR((Rt? sZ  K+($"C*4k 3 #,8' 8%