2 * Copyright (C) 2007 Michael Brown <mbrown@fensystems.co.uk>.
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <gpxe/stream.h>
31 * Send data via connection
33 * @v app Stream application
34 * @v data Data to send
35 * @v len Length of data
36 * @ret rc Return status code
38 * This method should be called only in the context of an
39 * application's senddata() method.
41 int stream_send ( struct stream_application *app, void *data, size_t len ) {
42 struct stream_connection *conn = app->conn;
45 DBGC2 ( app, "Stream %p sending %zd bytes\n", app, len );
47 /* Check connection actually exists */
49 DBGC ( app, "Stream %p has no connection\n", app );
53 /* Send data via connection */
54 if ( ( rc = conn->op->send ( conn, data, len ) ) != 0 ) {
55 DBGC ( app, "Stream %p failed to send %zd bytes: %s\n",
56 app, len, strerror ( rc ) );