summaryrefslogtreecommitdiffstats
path: root/src/core/xfer.c
Commit message (Collapse)AuthorAgeFilesLines
* [xfer] Ensure va_end() is called on failure pathMichael Brown2017-03-211-1/+1
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Send intf_close() if redirection failsMichael Brown2016-07-041-0/+5
| | | | | | | | | | A redirection failure is fatal, but provides no opportunity for the caller of xfer_[v]redirect() to report the failure since the interface will already have been disconnected. Fix by sending intf_close() from within the default xfer_vredirect() handler. Debugged-by: Robin Smidsrød <robin@smidsrod.no> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Add xfer_check_order() utility functionMichael Brown2015-07-221-0/+31
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Use intf_poke() to implement xfer_window_changed()Michael Brown2015-07-221-11/+1Star
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Relicense files under GPL2_OR_LATER_OR_UBDLMichael Brown2015-03-021-1/+5
| | | | | | | Relicense files for which I am the sole author (as identified by util/relicense.pl). Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [legal] Update FSF mailing address in GPL licence textsMichael Brown2012-07-201-1/+2
| | | | | Suggested-by: Daniel P. Berrange <berrange@redhat.com> Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Avoid using stack-allocated memory in xfer_printf()Michael Brown2012-04-231-7/+19
| | | | | | | | | | | xfer_printf() occasionally has to deal with strings that are potentially long, such as HTTP URIs with multiple query parameters. Allocating these on the stack can lead to stack overruns and memory corruption. Fix by using vasprintf() instead of a stack allocation. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Send xfer_window_changed() after xfer_vredirect()Michael Brown2011-06-281-1/+16
| | | | | | | | | | Modify the default action for xfer_vredirect() to automatically send xfer_window_changed() messages to both the new child and the parent interfaces. This will allow the elimination of processes that simply poll on xfer_window() to determine when a redirection has completed successfully. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Add xfer_window_changed()Michael Brown2010-09-051-0/+27
| | | | | | | | | xfer_window_changed() can be used to notify peers that an interface is now ready to accept data. This can potentially be used to eliminate the need for wasteful processes that simply poll xfer_window() until the window becomes non-zero. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Add xfer_deliver_raw_meta()Michael Brown2010-09-031-5/+20
| | | | Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Generalise metadata "whence" field to "flags" fieldMichael Brown2010-09-031-5/+4Star
| | | | | | | | | | | | | iPXE has never supported SEEK_END; the usage of "whence" offers only the options of SEEK_SET and SEEK_CUR and so is effectively a boolean flag. Further flags will be required to support additional metadata required by the Fibre Channel network model, so repurpose the "whence" field as a generic "flags" field. xfer_seek() has always been used with SEEK_SET, so remove the "whence" field altogether from its argument list. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Allow for non-pass-through interface methodsMichael Brown2010-06-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | | xfer_vredirect() should not be allowed to propagate to a pass-through interface. For example, when an HTTPS connection is opened, the redirect message should cause the TLS layer to reopen the TCP socket, rather than causing the HTTP layer to disconnect from the TLS layer. Fix by allowing for non-pass-through interface methods, and setting xfer_vredirect() to be one such method. This is slightly ugly, in that it complicates the notion of an interface method call by adding a "pass-through" / "non-pass-through" piece of metadata. However, the only current user of xfer_vredirect() is iscsi.c, which uses it only because we don't yet have an ioctl()-style call for retrieving the underlying socket address. The new interface infrastructure allows for such a call to be created, at which time this sole user of xfer_vredirect() can be removed, xfer_vredirect() can cease to be an interface method and become simply a wrapper around xfer_vreopen(), and the concept of a non-pass-through interface method can be reverted. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [interface] Convert all data-xfer interfaces to generic interfacesMichael Brown2010-06-221-245/+126Star
| | | | | | | | | | | | | | Remove data-xfer as an interface type, and replace data-xfer interfaces with generic interfaces supporting the data-xfer methods. Filter interfaces (as used by the TLS layer) are handled using the generic pass-through interface capability. A side-effect of this is that deliver_raw() no longer exists as a data-xfer method. (In practice this doesn't lose any efficiency, since there are no instances within the current codebase where xfer_deliver_raw() is used to pass data to an interface supporting the deliver_raw() method.) Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [build] Rename gPXE to iPXEMichael Brown2010-04-201-1/+1
| | | | | | | | | | | Access to the gpxe.org and etherboot.org domains and associated resources has been revoked by the registrant of the domain. Work around this problem by renaming project from gPXE to iPXE, and updating URLs to match. Also update README, LOG and COPYRIGHTS to remove obsolete information. Signed-off-by: Michael Brown <mcb30@ipxe.org>
* [xfer] Always nullify interface while sending close() messageMichael Brown2009-07-061-0/+3
| | | | | | | | | | | | | | | Objects typically call xfer_close() as part of their response to a close() message. If the initiating object has already nullified the xfer interface then this isn't a problem, but it can lead to unexpected behaviour when the initiating object is aiming to reuse the connection and so does not nullify the interface. Fix by always temporarily nullifying the interface during xfer_close() (as was already being done by xfer_vreopen() in order to work around this specific problem). Reported-by: infernix <infernix@infernix.net> Tested-by: infernix <infernix@infernix.net>
* [legal] Add a selection of FILE_LICENCE declarationsMichael Brown2009-05-181-0/+2
| | | | | Add FILE_LICENCE declarations to almost all files that make up the various standard builds of gPXE.
* [xfer] Make consistent assumptions that xfer metadata can never be NULLMichael Brown2009-02-151-2/+9
| | | | | | | | | | | | | The documentation in xfer.h and xfer.c does not say that the metadata parameter is optional in calls such as xfer_deliver_iob_meta() and the deliver_iob() method. However, some code in net/ is prepared to accept a NULL pointer, and xfer_deliver_as_iob() passes a NULL pointer directly to the deliver_iob() method. Fix this mess of conflicting assumptions by making everything assume that the metadata parameter is mandatory, and fixing xfer_deliver_as_iob() to pass in a dummy metadata structure (as is already done in xfer_deliver_iob()).
* Add XFER_INIT() macro.Michael Brown2008-01-221-7/+1Star
|
* Make seek information part of the xfer metadata, rather than an entirelyMichael Brown2008-01-081-41/+28Star
| | | | | | | separate xfer method. Add missing .alloc_iob entries to several xfer_interface_operations structures.
* Unplug before sending close() message, to avoid screwing up interfacesMichael Brown2007-07-101-1/+1
| | | | which respond to close with a reopen() (e.g. iSCSI).
* Remove xfer_ready() (it has been replaced by xfer_window())Michael Brown2007-07-091-14/+0Star
|
* Separate the "is data ready" function of xfer_seek() into anMichael Brown2007-07-081-0/+43
| | | | | xfer_window() function, which can return a scalar rather than a boolean.
* Kill off unused request() method in data-xfer interface.Michael Brown2007-07-081-43/+0Star
|
* Add concept of transfer metadata, to be used by UDP in order toMichael Brown2007-06-111-5/+22
| | | | implement sendto()/recvfrom() equivalents.
* Added missing va_end()Michael Brown2007-06-031-0/+1
|
* Add xfer_[v]printf() functions.Michael Brown2007-05-281-0/+41
|
* Modify data-xfer semantics: it is no longer necessary to call one ofMichael Brown2007-05-261-10/+61
| | | | | | | | | request(), seek() or deliver_xxx() in order to start the data flow. Autonomous generators must be genuinely autonomous (having their own process), or otherwise arrange to be called. TCP does this by starting the retry timer immediately. Add some debugging statements.
* Do not hold self-references. This then avoids the problem of having toMichael Brown2007-05-151-13/+32
| | | | | | | | | ensure that we only drop our self-reference exactly once. To maintain the guarantee that an object won't go out of scope unexpectedly while one of its event handlers is being called, the event-calling functions now automatically obtain and drop extra references.
* Data-transfer interface should now be functionally complete.Michael Brown2007-05-151-32/+92
|
* Add start() eventMichael Brown2007-05-011-26/+39
| | | | Add "xfer" to all xfer functions and "job" to all job functions.
* Add (and use) generic reference counter, to improve signal:noise ratioMichael Brown2007-04-301-1/+1
| | | | in code defining reference-counted objects.
* Add seek()Michael Brown2007-04-291-18/+75
| | | | Dehyphenate "data-transfer".
* Preliminary support for opening data-transfer interfacesMichael Brown2007-04-281-12/+64
|
* Added deliver-as-iobuf/deliver-as-raw concepts.Michael Brown2007-04-271-5/+58
|
* Initial sketch for the generic data-transfer interface.Michael Brown2007-04-271-0/+74