aboutsummaryrefslogtreecommitdiff
path: root/example/ipfragreass/odp_ipfragreass_fragment.h
blob: e0e8cfea7d062308ffceaceb008f90c808a940ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/* Copyright (c) 2017-2018, Linaro Limited
 * All rights reserved.
 *
 * SPDX-License-Identifier:     BSD-3-Clause
 */

#ifndef ODP_FRAGREASS_PP_FRAG_H_
#define ODP_FRAGREASS_PP_FRAG_H_

#include <odp/helper/ip.h>

#define MTU 1480 /**< IPv4 payload MTU */

ODP_STATIC_ASSERT(!(MTU % 8), "ODPFRAG_MTU__SIZE_ERROR");

/**
 * Break apart a larger-than-MTU packet into smaller IPv4 fragments
 *
 * @param      orig_packet The larger-than-MTU packet to fragment
 * @param[out] out	   The packet buffer to write fragments out to
 * @param[out] out_len	   The number of fragments produced
 *
 * @return 0 on success, -1 otherwise
 */
int fragment_ipv4_packet(odp_packet_t orig_packet, odp_packet_t *out,
			 int *out_len);

#endif