/**
 * @file rudp-light_types.h
 *
 * @brief Reliable User Datagram Protocol (RUDP) - minimal implemenation (types).
 *
 * Copyright 2007-2008, Freie Universitaet Berlin. All rights reserved.
 * Please refer to the COPYING file for detailed licensing information.
 *
 * @author Georg Wittenburg
 *
 * $Id: rudp-light_types.h 2685 2008-06-25 16:38:56Z wittenbu $
 */

#ifndef RUDP_LIGHT_TYPES_H
#define RUDP_LIGHT_TYPES_H

#include "../types.h"



/*
 * RUDP transmission type.
 */

/**
 * @brief Result of a transmission.
 */
typedef struct {
	C_addr_t		to;		///< Destination address of the RUDP packet.
	C_errno_t		error_code;	///< Error code.
	callback_parameter_t	parameter;	///< Parameter for the calling function.
} RUDP_transmission_result_t;

/**
 * @brief Packet transmission.
 */
typedef struct {
	C_packet_t			packet;		///< Packet to be transmitted.
	uint8_t				retries;	///< Number of retries left.
	uint16_t			callback_id;	///< ID of the timeout callback.
	callback_function_t		function;	///< Callback function.
	RUDP_transmission_result_t*	result;		///< Pointer to result of this transmission.
} RUDP_transmission_t;



/*
 * Packet types.
 */

/**
 * @brief RUDP DATA packet header.
 */
typedef struct {
	uint8_t		orig_app;	///< Application identifier of the encapsulated packet.
	uint8_t		orig_type;	///< Packet type of the encapsulated packet.
} RUDP_DATA_packet_t;

/**
 * @brief RUDP ACK packet.
 */
typedef struct {
	seqno_t		seqno;		///< Sequence number of acknowledged packet.
} RUDP_ACK_packet_t;

#endif	// RUDP_LIGHT_TYPES_H
