*
*/
+/**
+ * Dummy transfer metadata
+ *
+ * This gets passed to xfer_interface::deliver_iob() and equivalents
+ * when no metadata is available.
+ */
+static struct xfer_metadata dummy_metadata;
+
/**
* Close data transfer interface
*
*/
int xfer_deliver_iob ( struct xfer_interface *xfer,
struct io_buffer *iobuf ) {
- static struct xfer_metadata dummy_metadata;
return xfer_deliver_iob_meta ( xfer, iobuf, &dummy_metadata );
}
return -ENOMEM;
memcpy ( iob_put ( iobuf, len ), data, len );
- return xfer->op->deliver_iob ( xfer, iobuf, NULL );
+ return xfer->op->deliver_iob ( xfer, iobuf, &dummy_metadata );
}
/**
*
* @v xfer Data transfer interface
* @v iobuf Datagram I/O buffer
- * @v meta Data transfer metadata, or NULL
+ * @v meta Data transfer metadata
* @ret rc Return status code
*/
static int tcp_xfer_deliver_iob ( struct xfer_interface *xfer,
*
* @v xfer FTP data channel interface
* @v iobuf I/O buffer
- * @v meta Data transfer metadata, or NULL
+ * @v meta Data transfer metadata
* @ret rc Return status code
*/
static int ftp_data_deliver_iob ( struct xfer_interface *data,
*
* @v socket Transport layer interface
* @v iobuf I/O buffer
- * @v meta Data transfer metadata, or NULL
+ * @v meta Data transfer metadata
* @ret rc Return status code
*/
static int http_socket_deliver_iob ( struct xfer_interface *socket,
*
* @v xfer Data transfer interface
* @v iobuf Datagram I/O buffer
- * @v meta Data transfer metadata, or NULL
+ * @v meta Data transfer metadata
* @ret rc Return status code
*/
static int udp_xfer_deliver_iob ( struct xfer_interface *xfer,
struct xfer_metadata *meta ) {
struct udp_connection *udp =
container_of ( xfer, struct udp_connection, xfer );
- struct sockaddr_tcpip *src = NULL;
- struct sockaddr_tcpip *dest = NULL;
- struct net_device *netdev = NULL;
-
- /* Apply xfer metadata */
- if ( meta ) {
- src = ( struct sockaddr_tcpip * ) meta->src;
- dest = ( struct sockaddr_tcpip * ) meta->dest;
- netdev = meta->netdev;
- }
/* Transmit data, if possible */
- udp_tx ( udp, iobuf, src, dest, netdev );
+ udp_tx ( udp, iobuf, ( ( struct sockaddr_tcpip * ) meta->src ),
+ ( ( struct sockaddr_tcpip * ) meta->dest ), meta->netdev );
return 0;
}
int rc = 0;
/* Sanity checks */
- if ( ! meta ) {
- DBGC ( dhcp, "DHCP %p received packet without metadata\n",
- dhcp );
- rc = -EINVAL;
- goto err_no_meta;
- }
if ( ! meta->src ) {
DBGC ( dhcp, "DHCP %p received packet without source port\n",
dhcp );
dhcppkt_put ( dhcppkt );
err_alloc_dhcppkt:
err_no_src:
- err_no_meta:
free_iob ( iobuf );
return rc;
}
*
* @v tftp TFTP connection
* @v iobuf I/O buffer
- * @v meta Transfer metadata, or NULL
+ * @v meta Transfer metadata
* @ret rc Return status code
*/
static int tftp_rx ( struct tftp_request *tftp,
"%zd\n", tftp, len );
goto done;
}
- if ( ! meta ) {
- DBGC ( tftp, "TFTP %p received packet without metadata\n",
- tftp );
- goto done;
- }
if ( ! meta->src ) {
DBGC ( tftp, "TFTP %p received packet without source port\n",
tftp );
*
* @v socket Transport layer interface
* @v iobuf I/O buffer
- * @v meta Transfer metadata, or NULL
+ * @v meta Transfer metadata
* @ret rc Return status code
*/
static int tftp_socket_deliver_iob ( struct xfer_interface *socket,
*
* @v mc_socket Multicast transport layer interface
* @v iobuf I/O buffer
- * @v meta Transfer metadata, or NULL
+ * @v meta Transfer metadata
* @ret rc Return status code
*/
static int tftp_mc_socket_deliver_iob ( struct xfer_interface *mc_socket,