ip_packet: Allow creation of IP packets from data

This commit is contained in:
Tobias Brunner
2014-07-22 11:10:35 +02:00
parent b557f4a7cd
commit d56d9a45d4
2 changed files with 164 additions and 1 deletions
+13 -1
View File
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2012 Tobias Brunner
* Copyright (C) 2012-2014 Tobias Brunner
* Hochschule fuer Technik Rapperswil
*
* This program is free software; you can redistribute it and/or modify it
@@ -93,4 +93,16 @@ struct ip_packet_t {
*/
ip_packet_t *ip_packet_create(chunk_t packet);
/**
* Encode an IP packet from the given data.
*
* @param src source address (cloned)
* @param dst destination address (cloned)
* @param next_header the protocol (IPv4) or next header (IPv6)
* @param data complete data after basic IP header (cloned)
* @return ip_packet_t instance, or NULL if invalid
*/
ip_packet_t *ip_packet_create_from_data(host_t *src, host_t *dst,
u_int8_t next_header, chunk_t data);
#endif /** IP_PACKET_H_ @}*/