This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
stellar-stellar/src/packet/packet_layer.cpp

24 lines
488 B
C++
Raw Normal View History

#include "packet_priv.h"
int packet_get_layer(const struct packet *pkt, int idx, struct layer *out)
{
if (pkt == NULL || out == NULL)
{
return -1;
}
if (idx < 0 || idx >= pkt->layers_used)
{
return -1;
}
const struct raw_layer *raw = &pkt->layers[idx];
out->proto = raw->proto;
out->header_len = raw->hdr_len;
out->payload_len = raw->pld_len;
out->header.raw = raw->hdr_ptr;
out->payload = raw->pld_ptr;
return 0;
}