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/include/stellar/packet.h

45 lines
1.0 KiB
C
Raw Normal View History

#pragma once
2024-04-21 11:30:41 +08:00
#ifdef __cplusplus
extern "C"
{
#endif
#include <stdint.h>
#define MAX_SIDS 8
struct sids
{
uint16_t sid[MAX_SIDS];
int used;
};
void packet_prepend_sids(struct packet *pkt, const struct sids *sids);
enum packet_direction
{
PACKET_DIRECTION_OUTGOING = 0, // Internal -> External: 0
PACKET_DIRECTION_INCOMING = 1, // External -> Internal: 1
};
enum packet_direction packet_get_direction(const struct packet *pkt);
enum packet_action
{
PACKET_ACTION_FORWARD = 0, // must be zero
PACKET_ACTION_DROP = 1,
PACKET_ACTION_DEFER = 2, // TODO
};
void packet_set_action(struct packet *pkt, enum packet_action action);
enum packet_action packet_get_action(const struct packet *pkt);
uint64_t packet_get_session_id(const struct packet *pkt);
const char *packet_get_raw_data(const struct packet *pkt);
uint16_t packet_get_raw_len(const struct packet *pkt);
2024-04-11 19:44:02 +08:00
const char *packet_get_payload(const struct packet *pkt);
uint16_t packet_get_payload_len(const struct packet *pkt);
2024-04-21 11:30:41 +08:00
#ifdef __cplusplus
}
#endif