Ejemplo n.º 1
0
Archivo: xfer.c Proyecto: baloo/ipxe
/**
 * Deliver formatted string
 *
 * @v intf		Data transfer interface
 * @v format		Format string
 * @v args		Arguments corresponding to the format string
 * @ret rc		Return status code
 */
int xfer_vprintf ( struct interface *intf, const char *format,
		   va_list args ) {
	va_list args_tmp;
	char *buf;
	int len;
	int rc;

	/* Create temporary string */
	va_copy ( args_tmp, args );
	len = vasprintf ( &buf, format, args );
	if ( len < 0 ) {
		rc = len;
		goto err_asprintf;
	}
	va_end ( args_tmp );

	/* Transmit string */
	if ( ( rc = xfer_deliver_raw ( intf, buf, len ) ) != 0 )
		goto err_deliver;

 err_deliver:
	free ( buf );
 err_asprintf:
	return rc;
}
Ejemplo n.º 2
0
Archivo: hw.c Proyecto: 42wim/ipxe
static void hw_step ( struct hw *hw ) {
	int rc;

	if ( xfer_window ( &hw->xfer ) ) {
		rc = xfer_deliver_raw ( &hw->xfer, hw_msg, sizeof ( hw_msg ) );
		hw_finished ( hw, rc );
	}
}
Ejemplo n.º 3
0
/**
 * Send next packet in DNS request
 *
 * @v dns		DNS request
 */
static int dns_send_packet ( struct dns_request *dns ) {
	static unsigned int qid = 0;
	size_t qlen;

	/* Increment query ID */
	dns->query.dns.id = htons ( ++qid );

	DBGC ( dns, "DNS %p sending query ID %d\n", dns, qid );

	/* Start retransmission timer */
	start_timer ( &dns->timer );

	/* Send the data */
	qlen = ( ( ( void * ) dns->qinfo ) - ( ( void * ) &dns->query )
		 + sizeof ( dns->qinfo ) );
	return xfer_deliver_raw ( &dns->socket, &dns->query, qlen );
}