transfer::transmitter(3tcl) | Data transfer facilities | transfer::transmitter(3tcl) |
transfer::transmitter - Data source
package require Tcl 8.4
package require snit ?1.0?
package require transfer::copy ?0.2?
package require transfer::data::source ?0.2?
package require transfer::connect ?0.2?
package require transfer::transmitter ?0.2?
transfer::transmitter objectName ?options...?
transfer::transmitter stream channel chan host port ?arg...?
transfer::transmitter stream file path host port ?arg...?
objectName method ?arg arg ...?
objectName destroy
objectName start
objectName busy
This package pulls data sources and connection setup together into a combined object for the transmission of information over a socket. These objects understand all the options from objects created by the packages transfer::data::source and transfer::connect.
The object command will be created under the current namespace if the objectName is not fully qualified, and in the specified namespace otherwise. The fully qualified name of the object command is returned as the result of the command.
If both host and port are provided an active connection to the destination is made. If only a port is specified (with host the empty string) then a passive connection is made instead.
Any arguments after the port are treated as options and are used to configure the internal transmitter object. See the section Options for a list of the supported options and their meaning. Note however that the signature of the command prefix specified for the -command callback differs from the signature for the same option of the transmitter object. This callback is only given the number of bytes and transfered, and possibly an error message. No reference to the internally used transmitter object is made.
The result returned by the command is the empty string if it was set to make an active connection, and the port the internal transmitter object is listening on otherwise, i.e when it is configured to connect passively. See also the package transfer::connect and the description of the method connect for where this behaviour comes from.
All objects created by the ::transfer::transmitter command have the following general form:
The result returned by the method is the empty string for an object configured to make an active connection, and the port the object is listening on otherwise, i.e when it is configured to connect passively. See also the package transfer::connect and the description of the method connect for where this behaviour comes from.
All transmitter objects support the union of the options supported by their connect and data source components, plus two of their own. See also the documentation for the packages transfer::data::source and transfer::connect.
The envisioned main use is the specfication of tls::socket. I.e. this option allows the creation of secure transfer channels, without making this package explicitly dependent on the tls package.
See also section Secure connections.
One way to secure connections made by objects of this package is to require the package tls and then configure the option -socketcmd to force the use of command tls::socket to open the socket.
# Load and initialize tls package require tls tls::init -cafile /path/to/ca/cert -keyfile ... # Create a connector with secure socket setup, transfer::transmitter T -socketcmd tls::socket ... ...
This package uses the TLS package to handle the security for https urls and other socket connections.
Policy decisions like the set of protocols to support and what ciphers to use are not the responsibility of TLS, nor of this package itself however. Such decisions are the responsibility of whichever application is using the package, and are likely influenced by the set of servers the application will talk to as well.
For example, in light of the recent POODLE attack [http://googleonlinesecurity.blogspot.co.uk/2014/10/this-poodle-bites-exploiting-ssl-30.html] discovered by Google many servers will disable support for the SSLv3 protocol. To handle this change the applications using TLS must be patched, and not this package, nor TLS itself. Such a patch may be as simple as generally activating tls1 support, as shown in the example below.
package require tls tls::init -tls1 1 ;# forcibly activate support for the TLS1 protocol ... your own application code ...
This document, and the package it describes, will undoubtedly contain bugs and other problems. Please report such in the category transfer of the Tcllib Trackers [http://core.tcl.tk/tcllib/reportlist]. Please also report any ideas for enhancements you may have for either package and/or documentation.
When proposing code changes, please provide unified diffs, i.e the output of diff -u.
Note further that attachments are strongly preferred over inlined patches. Attachments can be made by going to the Edit form of the ticket immediately after its creation, and then using the left-most button in the secondary navigation bar.
channel, copy, data source, secure, ssl, tls, transfer, transmitter
Transfer module
Copyright (c) 2006-2009 Andreas Kupries <andreas_kupries@users.sourceforge.net>
0.2 | tcllib |