NewMadeleine

Documentation

« back to PM2 home.
nm_types.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2025 (see AUTHORS file)
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or (at
8 * your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * General Public License for more details.
14 */
15
16#include <stdint.h>
17
24#ifndef NM_TYPES_H
25#define NM_TYPES_H
26
27#include <Padico/Puk.h>
28
33/* ** Gates ************************************************ */
34
36typedef struct nm_gate_s*nm_gate_t;
37
39#define NM_GATE_NONE ((nm_gate_t)NULL)
40
41#define NM_ANY_GATE NM_GATE_NONE
42
45
48
50PUK_HASHTABLE_TYPE(nm_gate_reverse, nm_gate_t, int,
51 &puk_hash_pointer_default_hash, &puk_hash_pointer_default_eq, NULL);
52
53/* ** Tags ************************************************* */
54
56typedef uint64_t nm_tag_t;
58#define NM_TAG_MAX UINT64_MAX
59
61#define NM_TAG_MASK_FULL ((nm_tag_t)-1)
63#define NM_TAG_MASK_NONE ((nm_tag_t)0)
64
65/* ** packets length and offsets *************************** */
66
68typedef uint64_t nm_len_t;
69
71#define NM_LEN_UNDEFINED ((nm_len_t)-1)
73#define NM_LEN_MAX ((nm_len_t)-2)
74
75/* ** priorities ******************************************* */
76
78typedef int32_t nm_prio_t;
79
83/* ** Tracks *********************************************** */
84
86typedef int8_t nm_trk_id_t;
87struct nm_trk_s;
88
95
96/* ** Misc ************************************************* */
97
99typedef uint8_t nm_proto_t;
100
102typedef uint32_t nm_seq_t;
103
105#define NM_SEQ_NONE ((nm_seq_t)0)
106
108#define NM_SEQ_MAX ((nm_seq_t)-1)
109
111typedef uint64_t nm_req_seq_t;
112
113
114#endif /* NM_TYPES_H */
struct nm_gate_s * nm_gate_t
a gate; opaque type to designate a peer node
Definition nm_types.h:36
static nm_gate_t p_gate
int8_t nm_trk_id_t
ID of a track, assigned in order.
Definition nm_types.h:86
nm_trk_kind_e
Definition nm_types.h:90
@ nm_trk_small
small packets with headers & parsing
Definition nm_types.h:92
@ nm_trk_undefined
Definition nm_types.h:91
@ nm_trk_large
large packets with rdv, no header
Definition nm_types.h:93
void nm_gate_ref_set(nm_gate_t p_gate, void *ref)
Set the user-registered per-gate data.
uint64_t nm_req_seq_t
sequence number for requests
Definition nm_types.h:111
int32_t nm_prio_t
message priority
Definition nm_types.h:78
void * nm_gate_ref_get(nm_gate_t p_gate)
Get the user-registered per-gate data.
uint64_t nm_tag_t
user tags, 64 bits, contained in indirect hashtable
Definition nm_types.h:56
PUK_HASHTABLE_TYPE(nm_gate_reverse, nm_gate_t, int, &puk_hash_pointer_default_hash, &puk_hash_pointer_default_eq, NULL)
hash ranks by gate
uint64_t nm_len_t
data length used by nmad
Definition nm_types.h:68
uint32_t nm_seq_t
Sequence number for packets on a given gate/tag.
Definition nm_types.h:102
uint8_t nm_proto_t
protocol flags- not part of the public API, but needed for inline
Definition nm_types.h:99
enum nm_trk_kind_e nm_trk_kind_t
Connection to another process.
Definition nm_gate.h:104
a track on a given gate
Definition nm_gate.h:69