NewMadeleine

Documentation

« back to PM2 home.
nm_types.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2026 (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
81#define NM_PRIORITY_MIN INT_MIN
82
84#define NM_PRIORITY_MAX INT_MAX
85
89/* ** Tracks *********************************************** */
90
92typedef int8_t nm_trk_id_t;
93struct nm_trk_s;
94
101
102/* ** Misc ************************************************* */
103
105typedef uint8_t nm_proto_t;
106
108typedef uint32_t nm_seq_t;
109
111#define NM_SEQ_NONE ((nm_seq_t)0)
112
114#define NM_SEQ_MAX ((nm_seq_t)-1)
115
117typedef uint64_t nm_req_seq_t;
118
120#define NM_UUID_SIZE 32
121
124{
126 char zero;
127};
128
130#define NM_UUID_BINARY_SIZE 16
131
137
138#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:92
nm_trk_kind_e
Definition nm_types.h:96
@ nm_trk_kind_small
small packets with headers & parsing
Definition nm_types.h:98
@ nm_trk_kind_undefined
Definition nm_types.h:97
@ nm_trk_kind_large
large packets with rdv, no header
Definition nm_types.h:99
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:117
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
#define NM_UUID_SIZE
128 bits uuid, as 32 hexadecimal numbers
Definition nm_types.h:120
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:108
uint8_t nm_proto_t
protocol flags- not part of the public API, but needed for inline
Definition nm_types.h:105
#define NM_UUID_BINARY_SIZE
128 bits UUID as 16 binary bytes
Definition nm_types.h:130
enum nm_trk_kind_e nm_trk_kind_t
Connection to another process.
Definition nm_gate.h:109
a track on a given gate
Definition nm_gate.h:69
UUID in binary.
Definition nm_types.h:134
char bytes[16]
Definition nm_types.h:135
uuid in plain text (hex encoding)
Definition nm_types.h:124
char bytes[32]
Definition nm_types.h:125
char zero
Definition nm_types.h:126