NewMadeleine

Documentation

nm_types.h
Go to the documentation of this file.
1/*
2 * NewMadeleine
3 * Copyright (C) 2006-2022 (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
26#ifndef NM_TYPES_H
27#define NM_TYPES_H
28
29#include <Padico/Puk.h>
30
35/* ** Gates ************************************************ */
36
38typedef struct nm_gate_s*nm_gate_t;
39
41#define NM_GATE_NONE ((nm_gate_t)NULL)
42
43#define NM_ANY_GATE NM_GATE_NONE
44
47
50
52PUK_HASHTABLE_TYPE(nm_gate_reverse, nm_gate_t, int,
53 &puk_hash_pointer_default_hash, &puk_hash_pointer_default_eq, NULL);
54
55/* ** Tags ************************************************* */
56
58typedef uint64_t nm_tag_t;
60#define NM_TAG_MAX UINT64_MAX
61
63#define NM_TAG_MASK_FULL ((nm_tag_t)-1)
65#define NM_TAG_MASK_NONE ((nm_tag_t)0)
66
67/* ** packets length and offsets *************************** */
68
70typedef uint64_t nm_len_t;
71
73#define NM_LEN_UNDEFINED ((nm_len_t)-1)
75#define NM_LEN_MAX ((nm_len_t)-2)
76
77/* ** priorities ******************************************* */
78
80typedef int32_t nm_prio_t;
81
85/* ** Tracks *********************************************** */
86
88typedef int8_t nm_trk_id_t;
89struct nm_trk_s;
90
91typedef enum nm_trk_kind_e
92 {
97
98/* ** Misc ************************************************* */
99
101typedef uint8_t nm_proto_t;
102
104typedef uint32_t nm_seq_t;
105
107#define NM_SEQ_NONE ((nm_seq_t)0)
108
110#define NM_SEQ_MAX ((nm_seq_t)-1)
111
113typedef uint64_t nm_req_seq_t;
114
115
116#endif /* NM_TYPES_H */
struct nm_gate_s * nm_gate_t
a gate; opaque type to designate a peer node
Definition: nm_types.h:38
static nm_gate_t p_gate
int8_t nm_trk_id_t
ID of a track, assigned in order.
Definition: nm_types.h:88
nm_trk_kind_e
Definition: nm_types.h:92
@ nm_trk_small
small packets with headers & parsing
Definition: nm_types.h:94
@ nm_trk_undefined
Definition: nm_types.h:93
@ nm_trk_large
large packets with rdv, no header
Definition: nm_types.h:95
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:113
int32_t nm_prio_t
message priority
Definition: nm_types.h:80
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:58
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:70
uint32_t nm_seq_t
Sequence number for packets on a given gate/tag.
Definition: nm_types.h:104
uint8_t nm_proto_t
protocol flags- not part of the public API, but needed for inline
Definition: nm_types.h:101
enum nm_trk_kind_e nm_trk_kind_t
Connection to another process.
Definition: nm_gate.h:100
a track on a given gate
Definition: nm_gate.h:64