NewMadeleine

Documentation

« back to PM2 home.
nm_gate.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#ifndef NM_GATE_H
17#define NM_GATE_H
18
27{
30 struct nm_req_list_s unpacks;
31 struct nm_req_list_s pending_packs;
32 struct nm_unexpected_gtag_list_s unexpected;
33 struct nm_core_pending_event_list_s pending_events;
34};
35static inline void nm_gtag_ctor(struct nm_gtag_s*p_gtag, nm_core_tag_t tag __attribute__((unused)))
36{
39 nm_req_list_init(&p_gtag->unpacks);
40 nm_req_list_init(&p_gtag->pending_packs);
41 nm_unexpected_gtag_list_init(&p_gtag->unexpected);
42 nm_core_pending_event_list_init(&p_gtag->pending_events);
43}
44static inline void nm_gtag_dtor(struct nm_gtag_s*p_gtag __attribute__((unused)))
45{
46 assert(nm_core_pending_event_list_empty(&p_gtag->pending_events));
47}
48
50
52{
53 struct nm_req_list_s unpacks;
54 struct nm_unexpected_gate_list_s unexpected;
55};
56static inline void nm_matching_gsession_ctor(struct nm_matching_gsession_s*p_gsession, nm_core_tag_t tag __attribute__((unused)))
57{
58 nm_req_list_init(&p_gsession->unpacks);
59 nm_unexpected_gate_list_init(&p_gsession->unexpected);
60}
61static inline void nm_matching_gsession_dtor(struct nm_matching_gsession_s*p_gsession __attribute__((unused)))
62{
63}
64NM_TAG_TABLE_TYPE(nm_matching_gsession, struct nm_matching_gsession_s);
66
69{
72 struct nm_drv_s*p_drv;
73 struct puk_receptacle_NewMad_minidriver_s receptacle;
74 puk_instance_t instance;
75 struct nm_pkt_wrap_list_s active_pw_recv;
76 struct nm_pkt_wrap_list_s active_pw_send;
77 struct nm_pkt_wrap_list_s pending_pw_send;
81};
82
83PUK_HASHTABLE_TYPE(nm_trk, void*, struct nm_trk_s*,
84 &puk_hash_pointer_default_hash, &puk_hash_pointer_default_eq, NULL);
85
96
97
99PUK_LIST_DECLARE_TYPE2(nm_active_gate, struct nm_gate_s);
100
104{
107 PUK_LIST_LINK(nm_active_gate);
108
111
114
117
119 struct nm_gtag_table_s tags;
120
122 struct nm_matching_gsession_table_s gsessions;
123
125 struct nm_pkt_wrap_list_s pending_large_recv;
127 struct nm_pkt_wrap_list_s pending_large_send;
128
130 struct puk_receptacle_NewMad_Strategy_s strategy_receptacle;
131 puk_instance_t strategy_instance;
132
134 struct nm_req_chunk_list_s req_chunk_list;
135
137 struct nm_ctrl_chunk_list_s ctrl_chunk_list;
138
141};
142
144PUK_LIST_CREATE_FUNCS(nm_active_gate);
145
146#define NM_FOR_EACH_GATE(P_GATE, P_CORE) \
147 puk_list_foreach(nm_gate, P_GATE, &(P_CORE)->gate_list)
148
149#endif /* NM_GATE_H */
struct nm_core_event_s __attribute__
nm_tag_t tag
the user-supplied tag
#define NM_SEQ_FIRST
First sequence number.
static nm_gate_t p_gate
static struct nm_matching_gsession_s * nm_matching_gsession_bytag(struct nm_gate_s *p_gate, nm_core_tag_t core_tag)
PUK_HASHTABLE_TYPE(nm_trk, void *, struct nm_trk_s *, &puk_hash_pointer_default_hash, &puk_hash_pointer_default_eq, NULL)
static void nm_matching_gsession_dtor(struct nm_matching_gsession_s *p_gsession __attribute__((unused)))
Definition nm_gate.h:61
static void nm_matching_gsession_ctor(struct nm_matching_gsession_s *p_gsession, nm_core_tag_t tag __attribute__((unused)))
Definition nm_gate.h:56
enum nm_gate_status_e nm_gate_status_t
Definition nm_gate.h:95
nm_gate_status_e
status of a gate, used for dynamic connections
Definition nm_gate.h:88
@ NM_GATE_STATUS_CONNECTING
connection establishment is in progress
Definition nm_gate.h:90
@ NM_GATE_STATUS_DISCONNECTING
gate will be disconnected, do not post new request
Definition nm_gate.h:92
@ NM_GATE_STATUS_DISCONNECTED
gate has been disconnected, do not use
Definition nm_gate.h:93
@ NM_GATE_STATUS_INIT
gate created, not connected
Definition nm_gate.h:89
@ NM_GATE_STATUS_CONNECTED
gate actually connected, may be used/polled
Definition nm_gate.h:91
static void nm_gtag_dtor(struct nm_gtag_s *p_gtag __attribute__((unused)))
Definition nm_gate.h:44
PUK_LIST_DECLARE_TYPE(nm_gate)
PUK_LIST_DECLARE_TYPE2(nm_active_gate, struct nm_gate_s)
static void nm_gtag_ctor(struct nm_gtag_s *p_gtag, nm_core_tag_t tag __attribute__((unused)))
Definition nm_gate.h:35
PUK_LIST_CREATE_FUNCS(nm_gate)
#define NM_TAG_TABLE_TYPE(NAME, ENTRY_TYPE)
macro to generate tables indexed by tags
Definition nm_tags.h:57
int8_t nm_trk_id_t
ID of a track, assigned in order.
Definition nm_types.h:86
uint32_t nm_seq_t
Sequence number for packets on a given gate/tag.
Definition nm_types.h:102
enum nm_trk_kind_e nm_trk_kind_t
An internal tag.
Core NewMadeleine structure.
Definition nm_core.h:43
a driver.
Definition nm_drv.h:35
Connection to another process.
Definition nm_gate.h:104
puk_instance_t strategy_instance
Definition nm_gate.h:131
struct puk_receptacle_NewMad_Strategy_s strategy_receptacle
Strategy components elements.
Definition nm_gate.h:130
struct nm_core * p_core
NM core object.
Definition nm_gate.h:140
struct nm_pkt_wrap_list_s pending_large_send
large messages waiting for RTRs- list of pw, lookup by [gate,tag,seq,chunk_offset]
Definition nm_gate.h:127
PUK_LIST_LINK(nm_active_gate)
PUK_LIST_LINK(nm_gate)
link to store gates in the core gate_list
struct nm_ctrl_chunk_list_s ctrl_chunk_list
control chunks posted to the gate
Definition nm_gate.h:137
struct nm_matching_gsession_table_s gsessions
table of gate/session
Definition nm_gate.h:122
struct nm_trk_s * trks
Tracks opened for each driver.
Definition nm_gate.h:116
int n_trks
Number of tracks opened on this gate.
Definition nm_gate.h:113
struct nm_gtag_table_s tags
table of tag status
Definition nm_gate.h:119
struct nm_req_chunk_list_s req_chunk_list
send reqs posted to the gate
Definition nm_gate.h:134
nm_gate_status_t status
current status of the gate (connected / not connected)
Definition nm_gate.h:110
struct nm_pkt_wrap_list_s pending_large_recv
large messages waiting for Track 1 (or 2) to be free- list of pw
Definition nm_gate.h:125
status of tags on each gate
Definition nm_gate.h:27
struct nm_unexpected_gtag_list_s unexpected
unexpected chunks pending on this gate/tag; sorted by seq number
Definition nm_gate.h:32
struct nm_core_pending_event_list_s pending_events
events received out-of-order, waiting for dispatch
Definition nm_gate.h:33
nm_seq_t send_seq_number
next sequence number for send
Definition nm_gate.h:29
struct nm_req_list_s unpacks
posted unpacks on this gate/tag
Definition nm_gate.h:30
struct nm_req_list_s pending_packs
pack reqs waiting for ACK
Definition nm_gate.h:31
nm_seq_t recv_seq_number
next sequence number for recv
Definition nm_gate.h:28
struct nm_unexpected_gate_list_s unexpected
unexpected chunks pending on this gate/session; sorted by seq number
Definition nm_gate.h:54
struct nm_req_list_s unpacks
posted unpacks on this gate/session (any tag)
Definition nm_gate.h:53
a track on a given gate
Definition nm_gate.h:69
struct nm_pkt_wrap_list_s pending_pw_send
pw ready to post, waiting for track to be free
Definition nm_gate.h:77
nm_trk_kind_t kind
Definition nm_gate.h:80
puk_instance_t instance
driver instance
Definition nm_gate.h:74
struct nm_pkt_wrap_list_s active_pw_recv
active pws for recv on the given trk
Definition nm_gate.h:75
struct nm_pkt_wrap_list_s active_pw_send
active pws for send on the given trk
Definition nm_gate.h:76
size_t binary_url_size
size of the above url
Definition nm_gate.h:79
nm_trk_id_t trk_id
numeric ID of the track; usually NM_TRK_SMALL (=0) or NM_TRK_LARGE (=1); more in case of multi-rail
Definition nm_gate.h:70
struct nm_gate_s * p_gate
gate this trk belong to
Definition nm_gate.h:71
void * binary_url
url for the driver on this trk
Definition nm_gate.h:78
struct puk_receptacle_NewMad_minidriver_s receptacle
receptacle for the driver
Definition nm_gate.h:73
struct nm_drv_s * p_drv
driver attached to the track
Definition nm_gate.h:72