FD.io VPP  v18.01.2-1-g9b554f3
Vector Packet Processing
mc.h
Go to the documentation of this file.
1 /*
2  * mc.h: vlib reliable sequenced multicast distributed applications
3  *
4  * Copyright (c) 2010 Cisco and/or its affiliates.
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at:
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 #ifndef included_vlib_mc_h
19 #define included_vlib_mc_h
20 
21 #include <vppinfra/elog.h>
22 #include <vppinfra/fifo.h>
23 #include <vppinfra/mhash.h>
24 #include <vlib/node.h>
25 
26 #ifndef MC_EVENT_LOGGING
27 #define MC_EVENT_LOGGING 1
28 #endif
29 
32 {
34 }
35 
36 /*
37  * Used to uniquely identify hosts.
38  * For IP4 this would be ip4_address plus tcp/udp port.
39  */
40 typedef union
41 {
42  u8 as_u8[8];
44 } mc_peer_id_t;
45 
48 {
49  /* Peer id is already in network byte order. */
50  return i;
51 }
52 
53 always_inline int
55 {
56  return memcmp (a.as_u8, b.as_u8, sizeof (a.as_u8));
57 }
58 
59 /* Assert mastership. Lowest peer_id amount all peers wins mastership.
60  Only sent/received over mastership channel (MC_TRANSPORT_MASTERSHIP).
61  So, we don't need a message opcode. */
62 typedef CLIB_PACKED (struct
63  {
64  /* Peer id asserting mastership. */
65  mc_peer_id_t peer_id;
66  /* Global sequence number asserted. */
67  u32 global_sequence;}) mc_msg_master_assert_t;
68 
69 always_inline void
70 mc_byte_swap_msg_master_assert (mc_msg_master_assert_t * r)
71 {
72  if (mc_need_byte_swap ())
73  {
74  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
75  r->global_sequence = clib_byte_swap_u32 (r->global_sequence);
76  }
77 }
78 
79 #define foreach_mc_msg_type \
80  _ (master_assert) \
81  _ (join_or_leave_request) \
82  _ (join_reply) \
83  _ (user_request) \
84  _ (user_ack) \
85  _ (catchup_request) \
86  _ (catchup_reply)
87 
88 typedef enum
89 {
90 #define _(f) MC_MSG_TYPE_##f,
92 #undef _
94 
95 /* Request to join a given stream. Multicast over MC_TRANSPORT_JOIN. */
96 typedef CLIB_PACKED (struct
97  {
98 mc_peer_id_t peer_id; mc_relay_msg_type_t type:32;
99  /* MC_MSG_TYPE_join_or_leave_request */
100  /* Stream to join or leave. */
101  u32 stream_index;
102  /* join = 1, leave = 0 */
103  u8 is_join;}) mc_msg_join_or_leave_request_t;
104 
105 always_inline void
106 mc_byte_swap_msg_join_or_leave_request (mc_msg_join_or_leave_request_t * r)
107 {
108  if (mc_need_byte_swap ())
109  {
110  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
111  r->type = clib_byte_swap_u32 (r->type);
112  r->stream_index = clib_byte_swap_u32 (r->stream_index);
113  }
114 }
115 
116 /* Join reply. Multicast over MC_TRANSPORT_JOIN. */
117 typedef CLIB_PACKED (struct
118  {
119 mc_peer_id_t peer_id; mc_relay_msg_type_t type:32;
120  /* MC_MSG_TYPE_join_reply */
121  u32 stream_index;
122  /* Peer ID to contact to catchup with this stream. */
123  mc_peer_id_t catchup_peer_id;}) mc_msg_join_reply_t;
124 
125 always_inline void
126 mc_byte_swap_msg_join_reply (mc_msg_join_reply_t * r)
127 {
128  if (mc_need_byte_swap ())
129  {
130  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
131  r->type = clib_byte_swap_u32 (r->type);
132  r->stream_index = clib_byte_swap_u32 (r->stream_index);
133  r->catchup_peer_id = mc_byte_swap_peer_id (r->catchup_peer_id);
134  }
135 }
136 
137 /* Generic (application) request. Multicast over MC_TRANSPORT_USER_REQUEST_TO_RELAY and then
138  relayed by relay master after filling in global sequence number. */
139 typedef CLIB_PACKED (struct
140  {
141  mc_peer_id_t peer_id; u32 stream_index;
142  /* Global sequence number as filled in by relay master. */
143  u32 global_sequence;
144  /* Local sequence number as filled in by peer sending message. */
145  u32 local_sequence;
146  /* Size of request data. */
147  u32 n_data_bytes;
148  /* Opaque request data. */
149  u8 data[0];}) mc_msg_user_request_t;
150 
151 always_inline void
152 mc_byte_swap_msg_user_request (mc_msg_user_request_t * r)
153 {
154  if (mc_need_byte_swap ())
155  {
156  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
157  r->stream_index = clib_byte_swap_u32 (r->stream_index);
158  r->global_sequence = clib_byte_swap_u32 (r->global_sequence);
159  r->local_sequence = clib_byte_swap_u32 (r->local_sequence);
160  r->n_data_bytes = clib_byte_swap_u32 (r->n_data_bytes);
161  }
162 }
163 
164 /* Sent unicast over ACK channel. */
165 typedef CLIB_PACKED (struct
166  {
167  mc_peer_id_t peer_id;
168  u32 global_sequence; u32 stream_index;
169  u32 local_sequence;
170  i32 seq_cmp_result;}) mc_msg_user_ack_t;
171 
172 always_inline void
173 mc_byte_swap_msg_user_ack (mc_msg_user_ack_t * r)
174 {
175  if (mc_need_byte_swap ())
176  {
177  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
178  r->stream_index = clib_byte_swap_u32 (r->stream_index);
179  r->global_sequence = clib_byte_swap_u32 (r->global_sequence);
180  r->local_sequence = clib_byte_swap_u32 (r->local_sequence);
181  r->seq_cmp_result = clib_byte_swap_i32 (r->seq_cmp_result);
182  }
183 }
184 
185 /* Sent/received unicast over catchup channel (e.g. using TCP). */
186 typedef CLIB_PACKED (struct
187  {
188  mc_peer_id_t peer_id;
189  u32 stream_index;}) mc_msg_catchup_request_t;
190 
191 always_inline void
192 mc_byte_swap_msg_catchup_request (mc_msg_catchup_request_t * r)
193 {
194  if (mc_need_byte_swap ())
195  {
196  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
197  r->stream_index = clib_byte_swap_u32 (r->stream_index);
198  }
199 }
200 
201 /* Sent/received unicast over catchup channel. */
202 typedef CLIB_PACKED (struct
203  {
204  mc_peer_id_t peer_id; u32 stream_index;
205  /* Last global sequence number included in catchup data. */
206  u32 last_global_sequence_included;
207  /* Size of catchup data. */
208  u32 n_data_bytes;
209  /* Catchup data. */
210  u8 data[0];}) mc_msg_catchup_reply_t;
211 
212 always_inline void
213 mc_byte_swap_msg_catchup_reply (mc_msg_catchup_reply_t * r)
214 {
215  if (mc_need_byte_swap ())
216  {
217  r->peer_id = mc_byte_swap_peer_id (r->peer_id);
218  r->stream_index = clib_byte_swap_u32 (r->stream_index);
219  r->last_global_sequence_included =
220  clib_byte_swap_u32 (r->last_global_sequence_included);
221  r->n_data_bytes = clib_byte_swap_u32 (r->n_data_bytes);
222  }
223 }
224 
225 typedef struct _mc_serialize_msg
226 {
227  /* Name for this type. */
228  char *name;
229 
230  /* Functions to serialize/unserialize data. */
233 
234  /* Maximum message size in bytes when serialized.
235  If zero then this will be set to the largest sent message. */
236  u32 max_n_bytes_serialized;
237 
238  /* Opaque to use for first argument to serialize/unserialize function. */
239  u32 opaque;
240 
241  /* Index in global message vector. */
242  u32 global_index;
243 
244  /* Registration list */
245  struct _mc_serialize_msg *next_registration;
247 
248 typedef struct
249 {
250  /* Index into global message vector. */
253 
254 #define MC_SERIALIZE_MSG(x,...) \
255  __VA_ARGS__ mc_serialize_msg_t x; \
256 static void __mc_serialize_msg_registration_##x (void) \
257  __attribute__((__constructor__)) ; \
258 static void __mc_serialize_msg_registration_##x (void) \
259 { \
260  vlib_main_t * vm = vlib_get_main(); \
261  x.next_registration = vm->mc_msg_registrations; \
262  vm->mc_msg_registrations = &x; \
263 } \
264 __VA_ARGS__ mc_serialize_msg_t x
265 
266 typedef enum
267 {
274 
275 typedef struct
276 {
277  clib_error_t *(*tx_buffer) (void *opaque, mc_transport_type_t type,
278  u32 buffer_index);
279 
280  clib_error_t *(*tx_ack) (void *opaque, mc_peer_id_t peer_id,
281  u32 buffer_index);
282 
283  /* Returns catchup opaque. */
284  uword (*catchup_request_fun) (void *opaque, u32 stream_index,
285  mc_peer_id_t catchup_peer_id);
286 
287  void (*catchup_send_fun) (void *opaque, uword catchup_opaque,
288  u8 * data_vector);
289 
290  /* Opaque passed to callbacks. */
291  void *opaque;
292 
295 
296  /* Max packet size (MTU) for this transport.
297  For IP this is interface MTU less IP + UDP header size. */
299 
302 
303 typedef struct
304 {
305  /* Count of messages received from this peer from the past/future
306  (with seq_cmp != 0). */
310 
311 typedef struct
312 {
313  /* ID of this peer. */
315 
316  /* The last sequence we received from this peer. */
318 
321 
322 typedef struct
323 {
325 
326  /* Cached copy of local sequence number from buffer. */
328 
329  /* Number of times this buffer has been sent (retried). */
331 
332  /* Previous/next retries in doubly-linked list. */
333  u32 prev_index, next_index;
334 
335  /* Bitmap of all peers which have acked this msg */
337 
338  /* Message send or resend time */
340 } mc_retry_t;
341 
342 typedef struct
343 {
344  /* Number of retries sent for this stream. */
347 
348 struct mc_main_t;
349 struct mc_stream_t;
350 
351 typedef struct
352 {
353  /* Stream name. */
354  char *name;
355 
356  /* Number of outstanding messages. */
358 
359  /* Retry interval, in seconds */
361 
362  /* Retry limit */
364 
365  /* User rx buffer callback */
366  void (*rx_buffer) (struct mc_main_t * mc_main,
367  struct mc_stream_t * stream,
368  mc_peer_id_t peer_id, u32 buffer_index);
369 
370  /* User callback to create a snapshot */
371  u8 *(*catchup_snapshot) (struct mc_main_t * mc_main,
372  u8 * snapshot_vector,
373  u32 last_global_sequence_included);
374 
375  /* User callback to replay a snapshot */
376  void (*catchup) (struct mc_main_t * mc_main,
377  u8 * snapshot_data, u32 n_snapshot_data_bytes);
378 
379  /* Callback to save a snapshot for offline replay */
380  void (*save_snapshot) (struct mc_main_t * mc_main,
381  u32 is_catchup,
382  u8 * snapshot_data, u32 n_snapshot_data_bytes);
383 
384  /* Called when a peer dies */
385  void (*peer_died) (struct mc_main_t * mc_main,
386  struct mc_stream_t * stream, mc_peer_id_t peer_id);
388 
389 #define foreach_mc_stream_state \
390  _ (invalid) \
391  _ (name_known) \
392  _ (join_in_progress) \
393  _ (catchup) \
394  _ (ready)
395 
396 typedef enum
397 {
398 #define _(f) MC_STREAM_STATE_##f,
400 #undef _
402 
403 typedef struct mc_stream_t
404 {
406 
407  mc_stream_state_t state;
408 
409  /* Index in stream pool. */
411 
412  /* Stream index 0 is always for MC internal use. */
413 #define MC_STREAM_INDEX_INTERNAL 0
414 
416 
417  /* Head and tail index of retry pool. */
418  u32 retry_head_index, retry_tail_index;
419 
420  /*
421  * Country club for recently retired messages
422  * If the set of peers is expanding and a new peer
423  * misses a message, we can easily retire the FIFO
424  * element before we even know about the new peer
425  */
427 
428  /* Hash mapping local sequence to retry pool index. */
430 
431  /* catch-up fifo of VLIB buffer indices.
432  start recording when catching up. */
434 
436 
437  /* Peer pool. */
439 
440  /* Bitmap with ones for all peers in peer pool. */
442 
443  /* Map of 64 bit id to index in stream pool. */
445 
446  /* Timeout, in case we're alone in the world */
448 
450 
452 
453  /* Next sequence number to use */
455 
456  /*
457  * Last global sequence we processed.
458  * When supplying catchup data, we need to tell
459  * the client precisely where to start replaying
460  */
462 
463  /* Vector of unique messages we've sent on this stream. */
465 
466  /* Vector global message index into per stream message index. */
468 
469  /* Hashed by message name. */
471 
474 } mc_stream_t;
475 
476 always_inline void
478 {
479  pool_free (s->retry_pool);
482  pool_free (s->peers);
486 }
487 
488 always_inline void
490 {
491  memset (s, 0, sizeof (s[0]));
492  s->retry_head_index = s->retry_tail_index = ~0;
493 }
494 
495 typedef struct
496 {
501 
502 typedef enum
503 {
508 
509 typedef struct
510 {
512 
515 
516 typedef struct
517 {
521 
522 typedef struct mc_main_t
523 {
524  mc_relay_state_t relay_state;
525 
526  /* Mastership */
528 
530 
532 
533  /* Map of 64 bit id to index in stream pool. */
535 
536  /* The transport we're using. */
538 
539  /* Last-used global sequence number. */
541 
542  /* Vector of streams. */
544 
545  /* Hash table mapping stream name to pool index. */
547 
549 
551 
553 
555 
556  /* Node indices for mastership, join ager,
557  retry and catchup processes. */
563 
564  /* Global vector of messages. */
566 
567  /* Hash table mapping message name to index. */
569 
570  /* Shared serialize/unserialize main. */
571  serialize_main_t serialize_mains[VLIB_N_RX_TX];
572 
574 
575  /* Convenience variables */
578 
579  /* Maps 64 bit peer id to elog string table offset for this formatted peer id. */
581 
583 
584  /* For mc_unserialize. */
586 } mc_main_t;
587 
590 {
591  uword *p = hash_get (m->stream_index_by_name, name);
592  return p ? vec_elt_at_index (m->stream_vector, p[0]) : 0;
593 }
594 
597 {
598  return i < vec_len (m->stream_vector) ? m->stream_vector + i : 0;
599 }
600 
601 always_inline void
603 {
604  mc_stream_t *s;
605  mc_stream_peer_t *p;
606  vec_foreach (s, m->stream_vector)
607  {
608  s->stats_last_clear = s->stats;
609  /* *INDENT-OFF* */
610  pool_foreach (p, s->peers, ({
611  p->stats_last_clear = p->stats;
612  }));
613  /* *INDENT-ON* */
614  }
615 }
616 
617 /* Declare all message handlers. */
618 #define _(f) void mc_msg_##f##_handler (mc_main_t * mcm, mc_msg_##f##_t * msg, u32 buffer_index);
620 #undef _
622 
623 void mc_stream_leave (mc_main_t * mcm, u32 stream_index);
624 
625 void mc_wait_for_stream_ready (mc_main_t * m, char *stream_name);
626 
627 u32 mc_stream_send (mc_main_t * mcm, u32 stream_index, u32 buffer_index);
628 
629 void mc_main_init (mc_main_t * mcm, char *tag);
630 
631 void mc_enable_disable_mastership (mc_main_t * mcm, int we_can_be_master);
632 
633 void *mc_get_vlib_buffer (struct vlib_main_t *vm, u32 n_bytes,
634  u32 * bi_return);
635 
637 
639  u32 stream_index,
640  u32 multiple_messages_per_vlib_buffer,
641  mc_serialize_msg_t * msg, ...);
642 
644  u32 stream_index,
645  u32 multiple_messages_per_vlib_buffer,
646  mc_serialize_msg_t * msg, va_list * va);
647 
648 #define mc_serialize_stream(mc,si,msg,args...) \
649  mc_serialize_internal((mc),(si),(0),(msg),(msg)->serialize,args)
650 
651 #define mc_serialize(mc,msg,args...) \
652  mc_serialize_internal((mc),(~0),(0),(msg),(msg)->serialize,args)
653 
654 #define mc_serialize2(mc,add,msg,args...) \
655  mc_serialize_internal((mc),(~0),(add),(msg),(msg)->serialize,args)
656 
657 void mc_unserialize (mc_main_t * mcm, mc_stream_t * s, u32 buffer_index);
659  serialize_main_t * m);
660 
662 
665 {
666  return mcm->transport.max_packet_size - sizeof (mc_msg_user_request_t);
667 }
668 
671 {
672  return mc_max_message_size_in_bytes (mcm) -
674 }
675 
676 void unserialize_mc_stream (serialize_main_t * m, va_list * va);
677 void mc_stream_join_process_hold (void);
678 
679 #endif /* included_vlib_mc_h */
680 
681 /*
682  * fd.io coding-style-patch-verification: ON
683  *
684  * Local Variables:
685  * eval: (c-set-style "gnu")
686  * End:
687  */
static mc_stream_t * mc_stream_by_index(mc_main_t *m, u32 i)
Definition: mc.h:596
u32 last_global_sequence_processed
Definition: mc.h:461
u32 buffer_index
Definition: mc.h:324
mc_stream_state_t state
Definition: mc.h:407
mhash_t mastership_peer_index_by_id
Definition: mc.h:534
Definition: mhash.h:46
sll srl srl sll sra u16x4 i
Definition: vector_sse2.h:337
static void mc_stream_init(mc_stream_t *s)
Definition: mc.h:489
mc_relay_state_t
Definition: mc.h:502
void mc_main_init(mc_main_t *mcm, char *tag)
Definition: mc.c:2417
static uword mc_need_byte_swap(void)
Definition: mc.h:31
static void mc_stream_free(mc_stream_t *s)
Definition: mc.h:477
elog_main_t * elog_main
Definition: mc.h:577
uword * all_peer_bitmap
Definition: mc.h:441
u64 user_requests_received
Definition: mc.h:473
f64 sent_at
Definition: mc.h:339
a
Definition: bitmap.h:516
static void mc_byte_swap_msg_join_reply(mc_msg_join_reply_t *r)
Definition: mc.h:126
mhash_t peer_index_by_id
Definition: mc.h:444
vlib_one_time_waiting_process_t * procs_waiting_for_join_done
Definition: mc.h:449
u64 n_msgs_from_future
Definition: mc.h:308
u32 last_sequence_received
Definition: mc.h:317
void mc_stream_join_process_hold(void)
Definition: mc.c:722
static u32 clib_byte_swap_u32(u32 x)
Definition: byte_order.h:76
static void mc_byte_swap_msg_user_request(mc_msg_user_request_t *r)
Definition: mc.h:152
#define CLIB_ARCH_IS_LITTLE_ENDIAN
Definition: byte_order.h:45
mc_serialize_msg_t ** global_msgs
Definition: mc.h:565
#define foreach_mc_stream_state
Definition: mc.h:389
struct mc_main_t mc_main_t
mc_stream_state_t
Definition: mc.h:396
u32 * catchup_fifo
Definition: mc.h:433
static uword mc_max_message_size_in_bytes(mc_main_t *mcm)
Definition: mc.h:664
u8 *( format_function_t)(u8 *s, va_list *args)
Definition: format.h:48
u64 relay_master_peer_id
Definition: mc.h:529
static void mc_byte_swap_msg_catchup_reply(mc_msg_catchup_reply_t *r)
Definition: mc.h:213
mc_stream_stats_t stats
Definition: mc.h:435
u32 index
Definition: mc.h:410
typedef CLIB_PACKED(struct{mc_peer_id_t peer_id;u32 global_sequence;}) mc_msg_master_assert_t
f64 join_timeout
Definition: mc.h:447
u32 relay_global_sequence
Definition: mc.h:540
format_function_t format_mc_main
Definition: mc.h:636
mc_retry_t * retry_pool
Definition: mc.h:415
u32 retry_tail_index
Definition: mc.h:418
u32 n_retries
Definition: mc.h:330
static word mc_serialize_n_bytes_left(mc_main_t *mcm, serialize_main_t *m)
Definition: mc.h:670
uword * stream_msg_index_by_name
Definition: mc.h:470
#define pool_foreach(VAR, POOL, BODY)
Iterate through pool.
Definition: pool.h:438
struct mc_stream_t mc_stream_t
mc_stream_config_t config
Definition: mc.h:405
#define always_inline
Definition: clib.h:92
static i32 clib_byte_swap_i32(i32 x)
Definition: byte_order.h:95
int i32
Definition: types.h:81
clib_error_t * mc_serialize_internal(mc_main_t *mc, u32 stream_index, u32 multiple_messages_per_vlib_buffer, mc_serialize_msg_t *msg,...)
Definition: mc.c:2076
#define vec_elt_at_index(v, i)
Get vector value at index i checking that i is in bounds.
void * opaque
Definition: mc.h:291
void unserialize_mc_stream(serialize_main_t *m, va_list *va)
Definition: mc.c:1467
unsigned long u64
Definition: types.h:89
mc_peer_id_t our_catchup_peer_id
Definition: mc.h:294
u32 retry_head_index
Definition: mc.h:418
uword * stream_index_by_name
Definition: mc.h:546
uword * procs_waiting_for_stream_name_by_name
Definition: mc.h:548
void mc_wait_for_stream_ready(mc_main_t *m, char *stream_name)
Definition: mc.c:993
u32 join_ager_process
Definition: mc.h:559
mc_mastership_peer_t * mastership_peers
Definition: mc.h:531
static u32 serialize_vlib_buffer_n_bytes(serialize_main_t *m)
Definition: buffer.h:507
serialize_function_t unserialize_mc_main
Definition: mc.h:661
char * name
Definition: main.h:100
#define hash_get(h, key)
Definition: hash.h:248
foreach_mc_msg_type u32 mc_stream_join(mc_main_t *mcm, mc_stream_config_t *)
Definition: mc.c:879
u64 as_u64
Definition: mc.h:43
vlib_one_time_waiting_process_t * procs_waiting_for_open_window
Definition: mc.h:451
uword mc_unserialize_message(mc_main_t *mcm, mc_stream_t *s, serialize_main_t *m)
Definition: mc.c:2101
uword * unacked_by_peer_bitmap
Definition: mc.h:336
u32 prev_index
Definition: mc.h:333
static void mc_byte_swap_msg_master_assert(mc_msg_master_assert_t *r)
Definition: mc.h:70
void mc_stream_leave(mc_main_t *mcm, u32 stream_index)
Definition: mc.c:885
#define hash_free(h)
Definition: hash.h:309
u32 mastership_process
Definition: mc.h:558
f64 time_last_master_assert_received
Definition: mc.h:513
mc_catchup_process_arg_t * catchup_process_args
Definition: mc.h:554
static void mc_clear_stream_stats(mc_main_t *m)
Definition: mc.h:602
u32 catchup_process
Definition: mc.h:561
mc_peer_id_t peer_id
Definition: mc.h:511
void mc_enable_disable_mastership(mc_main_t *mcm, int we_can_be_master)
Definition: mc.c:1879
u32 retry_process
Definition: mc.h:560
u32 mc_stream_send(mc_main_t *mcm, u32 stream_index, u32 buffer_index)
Definition: mc.c:1016
mc_peer_id_t our_ack_peer_id
Definition: mc.h:293
static void catchup_send_fun(void *transport_main, uword opaque, u8 *data)
Definition: mc_socket.c:925
#define pool_free(p)
Free a pool.
Definition: pool.h:352
The fine-grained event logger allows lightweight, thread-safe event logging at minimum cost...
void * mc_get_vlib_buffer(struct vlib_main_t *vm, u32 n_bytes, u32 *bi_return)
Definition: mc.c:110
mc_relay_msg_type_t
Definition: mc.h:88
clib_error_t * serialize(serialize_main_t *m,...)
Definition: serialize.c:671
u32 retry_limit
Definition: mc.h:363
#define vec_free(V)
Free vector&#39;s memory (no header).
Definition: vec.h:336
Definition: mc.h:322
u32 window_size
Definition: mc.h:357
f64 retry_interval
Definition: mc.h:360
mhash_t elog_id_by_peer_id
Definition: mc.h:580
static int mc_peer_id_compare(mc_peer_id_t a, mc_peer_id_t b)
Definition: mc.h:54
mc_retry_t * retired_fifo
Definition: mc.h:426
void mc_unserialize(mc_main_t *mcm, mc_stream_t *s, u32 buffer_index)
Definition: mc.c:2264
u32 max_packet_size
Definition: mc.h:298
u8 as_u8[8]
Definition: mc.h:42
mc_stream_stats_t stats_last_clear
Definition: mc.h:435
Definition: mc.h:522
unsigned int u32
Definition: types.h:88
static void mc_byte_swap_msg_user_ack(mc_msg_user_ack_t *r)
Definition: mc.h:173
char * name
Definition: mc.h:354
static mc_stream_t * mc_stream_by_name(mc_main_t *m, char *name)
Definition: mc.h:589
static void mhash_free(mhash_t *h)
Definition: mhash.h:149
mc_serialize_stream_msg_t * stream_msgs
Definition: mc.h:464
clib_error_t * unserialize(serialize_main_t *m,...)
Definition: serialize.c:683
u32 we_can_be_relay_master
Definition: mc.h:527
#define clib_fifo_free(f)
Definition: fifo.h:257
vlib_one_time_waiting_process_t ** procs_waiting_for_stream_name_pool
Definition: mc.h:550
u64 uword
Definition: types.h:112
uword * global_msg_index_by_name
Definition: mc.h:568
mc_transport_type_t
Definition: mc.h:266
int joins_in_progress
Definition: mc.h:552
i64 word
Definition: types.h:111
u32 unserialize_process
Definition: mc.h:562
mc_relay_state_t relay_state
Definition: mc.h:524
struct _mc_serialize_msg mc_serialize_msg_t
#define vec_len(v)
Number of elements in vector (rvalue-only, NULL tolerant)
double f64
Definition: types.h:142
void( serialize_function_t)(serialize_main_t *m, va_list *va)
Definition: serialize.h:168
unsigned char u8
Definition: types.h:56
mc_stream_peer_stats_t stats_last_clear
Definition: mc.h:319
uword * retry_index_by_local_sequence
Definition: mc.h:429
mc_stream_peer_t * peers
Definition: mc.h:438
static void mc_byte_swap_msg_join_or_leave_request(mc_msg_join_or_leave_request_t *r)
Definition: mc.h:106
u64 user_requests_sent
Definition: mc.h:472
uword * elog_id_by_msg_name
Definition: mc.h:582
mc_peer_id_t id
Definition: mc.h:314
u64 n_msgs_from_past
Definition: mc.h:307
u64 n_retries
Definition: mc.h:345
mc_stream_and_buffer_t * mc_unserialize_stream_and_buffers
Definition: mc.h:585
serialize_function_t serialize_mc_main
Definition: mc.h:661
format_function_t * format_peer_id
Definition: mc.h:300
u32 our_local_sequence
Definition: mc.h:454
clib_error_t * mc_serialize_va(mc_main_t *mc, u32 stream_index, u32 multiple_messages_per_vlib_buffer, mc_serialize_msg_t *msg, va_list *va)
Definition: mc.c:1993
#define vec_foreach(var, vec)
Vector iterator.
#define foreach_mc_msg_type
Definition: mc.h:79
u32 local_sequence
Definition: mc.h:327
u32 * stream_msg_index_by_global_index
Definition: mc.h:467
struct vlib_main_t * vlib_main
Definition: mc.h:576
static mc_peer_id_t mc_byte_swap_peer_id(mc_peer_id_t i)
Definition: mc.h:47
static uword catchup_request_fun(void *transport_main, u32 stream_index, mc_peer_id_t catchup_peer_id)
Definition: mc_socket.c:843
mc_transport_t transport
Definition: mc.h:537
mc_stream_t * stream_vector
Definition: mc.h:543
static void mc_byte_swap_msg_catchup_request(mc_msg_catchup_request_t *r)
Definition: mc.h:192