strongswan/Source/charon/network/packet.h

80 lines
1.6 KiB
C
Raw Normal View History

/**
* @file packet.h
*
2005-11-29 08:08:03 +00:00
* @brief Interface of packet_t.
*
*/
/*
* Copyright (C) 2005 Jan Hutter, Martin Willi
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
#ifndef PACKET_H_
#define PACKET_H_
2005-11-23 09:24:35 +00:00
#include <types.h>
2005-11-23 16:17:28 +00:00
#include <network/host.h>
2005-11-24 09:17:51 +00:00
typedef struct packet_t packet_t;
/**
2005-11-29 08:08:03 +00:00
* @brief Abstraction of an UDP-Packet, contains data, sender and receiver.
*
* @ingroup network
*/
2005-11-24 09:17:51 +00:00
struct packet_t {
/**
* source address structure
*/
host_t *source;
/**
* destination address structure
*/
host_t *destination;
/**
* message data
*/
chunk_t data;
2005-11-07 11:46:18 +00:00
/**
2005-11-29 08:08:03 +00:00
* @brief Clones a packet_t object.
*
2005-11-29 08:08:03 +00:00
* @param packet calling object
* @param clone pointer to a packet_t object pointer where the new object is stored
*/
2005-11-29 08:08:03 +00:00
packet_t* (*clone) (packet_t *packet);
/**
2005-11-29 08:08:03 +00:00
* @brief Destroy the packet, freeing contained data.
*
2005-11-07 11:46:18 +00:00
* @param packet packet to destroy
*/
2005-11-29 08:08:03 +00:00
void (*destroy) (packet_t *packet);
};
/**
2005-11-07 11:46:18 +00:00
* @brief create an empty packet
*
2005-11-29 08:08:03 +00:00
* @return created packet_t object
*
* @ingroup network
*/
packet_t *packet_create();
#endif /*PACKET_H_*/