example/ipsec_api/odp_ipsec.c
static
pkt_disposition_e do_route_fwd_db(odp_packet_t pkt, pkt_ctx_t *ctx)
{
	odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
	fwd_db_entry_t *entry;

	entry = find_fwd_db_entry(odp_be_to_cpu_32(ip->dst_addr));

	if (entry) {
		uint32_t l3_offset = odp_packet_l3_offset(pkt);

		if (l3_offset > sizeof(odph_ethhdr_t))
			odp_packet_pull_head(pkt,
					     l3_offset - sizeof(odph_ethhdr_t));
		else
			odp_packet_push_head(pkt,
					     sizeof(odph_ethhdr_t) - l3_offset);

		memcpy(&ctx->eth.dst, entry->dst_mac, ODPH_ETHADDR_LEN);
		memcpy(&ctx->eth.src, entry->src_mac, ODPH_ETHADDR_LEN);
		ctx->eth.type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4);

		if (global->appl.mode != ODP_IPSEC_OP_MODE_INLINE) {
			odp_packet_l2_offset_set(pkt, 0);
			odp_packet_copy_from_mem(pkt, 0, ODPH_ETHHDR_LEN,
						 &ctx->eth);
		}

		ctx->pktio = entry->pktio;
		ctx->pktout = entry->pktout;

		return PKT_CONTINUE;
	}

	return PKT_DROP;
}
/**
 * Packet Processing - Route lookup in forwarding database
 *
 * @param pkt  Packet to route
 * @param ctx  Packet process context
 *
 * @return PKT_CONTINUE if route found else PKT_DROP
 */
Packet Processing - Route lookup in forwarding database
@param pkt  Packet to route
@param ctx  Packet process context

@return PKT_CONTINUE if route found else PKT_DROP
Packet Processing - Route lookup in forwarding database @param pkt Packet to route @param ctx Packet process context @return PKT_CONTINUE if route found else PKT_DROP
static
pkt_disposition_e do_route_fwd_db(odp_packet_t pkt, pkt_ctx_t *ctx)
{
	odph_ipv4hdr_t *ip = (odph_ipv4hdr_t *)odp_packet_l3_ptr(pkt, NULL);
	fwd_db_entry_t *entry;
	entry = find_fwd_db_entry(odp_be_to_cpu_32(ip->dst_addr));
	if (entry) {
		uint32_t l3_offset = odp_packet_l3_offset(pkt);
		if (l3_offset > sizeof(odph_ethhdr_t))
			odp_packet_pull_head(pkt,
					     l3_offset - sizeof(odph_ethhdr_t));
		else
			odp_packet_push_head(pkt,
					     sizeof(odph_ethhdr_t) - l3_offset);
		memcpy(&ctx->eth.dst, entry->dst_mac, ODPH_ETHADDR_LEN);
		memcpy(&ctx->eth.src, entry->src_mac, ODPH_ETHADDR_LEN);
		ctx->eth.type = odp_cpu_to_be_16(ODPH_ETHTYPE_IPV4);
		if (global->appl.mode != ODP_IPSEC_OP_MODE_INLINE) {
			odp_packet_l2_offset_set(pkt, 0);
			odp_packet_copy_from_mem(pkt, 0, ODPH_ETHHDR_LEN,
						 &ctx->eth);
		}
		ctx->pktio = entry->pktio;
		ctx->pktout = entry->pktout;
		return PKT_CONTINUE;
	}
	return PKT_DROP;
}
static pkt_disposition_e do_route_fwd_db ( odp_packet_t pkt , pkt_ctx_t * ctx ) { odph_ipv4hdr_t * ip = ( odph_ipv4hdr_t * ) odp_packet_l3_ptr ( pkt , NULL ) ; fwd_db_entry_t * entry ; entry = find_fwd_db_entry ( odp_be_to_cpu_32 ( ip -> dst_addr ) ) ; if ( entry ) { uint32_t l3_offset = odp_packet_l3_offset ( pkt ) ; if ( l3_offset > sizeof ( odph_ethhdr_t ) ) odp_packet_pull_head ( pkt , l3_offset - sizeof ( odph_ethhdr_t ) ) ; else odp_packet_push_head ( pkt , sizeof ( odph_ethhdr_t ) - l3_offset ) ; memcpy ( & ctx -> eth . dst , entry -> dst_mac , ODPH_ETHADDR_LEN ) ; memcpy ( & ctx -> eth . src , entry -> src_mac , ODPH_ETHADDR_LEN ) ; ctx -> eth . type = odp_cpu_to_be_16 ( ODPH_ETHTYPE_IPV4 ) ; if ( global -> appl . mode != ODP_IPSEC_OP_MODE_INLINE ) { odp_packet_l2_offset_set ( pkt , 0 ) ; odp_packet_copy_from_mem ( pkt , 0 , ODPH_ETHHDR_LEN , & ctx -> eth ) ; } ctx -> pktio = entry -> pktio ; ctx -> pktout = entry -> pktout ; return PKT_CONTINUE ; } return PKT_DROP ; }
Packet Processing - Route lookup in forwarding database
 @param pkt  Packet to route
 @param ctx  Packet process context
Packet Processing - Route lookup in forwarding database @param pkt Packet to route @param ctx Packet process context