machnet 0.1.9

A Rust FFI bindings for Machnet
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
/* automatically generated by rust-bindgen 0.69.4 */

pub type MachnetRingSlot_t = u32;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MachnetFlow {
    pub src_ip: u32,
    pub dst_ip: u32,
    pub src_port: u16,
    pub dst_port: u16,
}
#[test]
fn bindgen_test_layout_MachnetFlow() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetFlow> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetFlow>(),
        12usize,
        concat!("Size of: ", stringify!(MachnetFlow))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetFlow>(),
        4usize,
        concat!("Alignment of ", stringify!(MachnetFlow))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).src_ip) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetFlow),
            "::",
            stringify!(src_ip)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).dst_ip) as usize - ptr as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetFlow),
            "::",
            stringify!(dst_ip)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).src_port) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetFlow),
            "::",
            stringify!(src_port)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).dst_port) as usize - ptr as usize },
        10usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetFlow),
            "::",
            stringify!(dst_port)
        )
    );
}
pub type MachnetFlow_t = MachnetFlow;
#[repr(C)]
#[repr(align(64))]
#[derive(Debug, Copy, Clone)]
pub struct MachnetChannelDataCtx {
    pub stats_ofs: usize,
    pub ctrl_sq_ring_ofs: usize,
    pub ctrl_cq_ring_ofs: usize,
    pub machnet_ring_ofs: usize,
    pub app_ring_ofs: usize,
    pub buf_ring_ofs: usize,
    pub buffer_index_table_ofs: usize,
    pub buf_pool_ofs: usize,
    pub buf_pool_mask: usize,
    pub buf_size: u32,
    pub buf_mss: u32,
}
#[test]
fn bindgen_test_layout_MachnetChannelDataCtx() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetChannelDataCtx> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetChannelDataCtx>(),
        128usize,
        concat!("Size of: ", stringify!(MachnetChannelDataCtx))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetChannelDataCtx>(),
        64usize,
        concat!("Alignment of ", stringify!(MachnetChannelDataCtx))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).stats_ofs) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(stats_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).ctrl_sq_ring_ofs) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(ctrl_sq_ring_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).ctrl_cq_ring_ofs) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(ctrl_cq_ring_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).machnet_ring_ofs) as usize - ptr as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(machnet_ring_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).app_ring_ofs) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(app_ring_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buf_ring_ofs) as usize - ptr as usize },
        40usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buf_ring_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buffer_index_table_ofs) as usize - ptr as usize },
        48usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buffer_index_table_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buf_pool_ofs) as usize - ptr as usize },
        56usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buf_pool_ofs)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buf_pool_mask) as usize - ptr as usize },
        64usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buf_pool_mask)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buf_size) as usize - ptr as usize },
        72usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buf_size)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).buf_mss) as usize - ptr as usize },
        76usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelDataCtx),
            "::",
            stringify!(buf_mss)
        )
    );
}
pub type MachnetChannelDataCtx_t = MachnetChannelDataCtx;
#[repr(C)]
#[repr(align(64))]
#[derive(Debug, Copy, Clone)]
pub struct MachnetChannelCtrlCtx {
    pub req_id: usize,
}
#[test]
fn bindgen_test_layout_MachnetChannelCtrlCtx() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetChannelCtrlCtx> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetChannelCtrlCtx>(),
        64usize,
        concat!("Size of: ", stringify!(MachnetChannelCtrlCtx))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetChannelCtrlCtx>(),
        64usize,
        concat!("Alignment of ", stringify!(MachnetChannelCtrlCtx))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).req_id) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtrlCtx),
            "::",
            stringify!(req_id)
        )
    );
}
pub type MachnetChannelCtrlCtx_t = MachnetChannelCtrlCtx;
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MachnetChannelAppBufferCache {
    pub count: u32,
    pub indices: [MachnetRingSlot_t; 64usize],
}
#[test]
fn bindgen_test_layout_MachnetChannelAppBufferCache() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetChannelAppBufferCache> =
        ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetChannelAppBufferCache>(),
        260usize,
        concat!("Size of: ", stringify!(MachnetChannelAppBufferCache))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetChannelAppBufferCache>(),
        4usize,
        concat!("Alignment of ", stringify!(MachnetChannelAppBufferCache))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).count) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelAppBufferCache),
            "::",
            stringify!(count)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).indices) as usize - ptr as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelAppBufferCache),
            "::",
            stringify!(indices)
        )
    );
}
pub type MachnetChannelAppBufferCache_t = MachnetChannelAppBufferCache;
#[doc = " The `MachnetChannelCtx' holds all the metadata information (context) of an\n Machnet Channel.\n\n It is always located at the beginning of the shared memory area."]
#[repr(C)]
#[repr(align(64))]
#[derive(Debug, Copy, Clone)]
pub struct MachnetChannelCtx {
    pub magic: u32,
    pub version: u16,
    pub size: u64,
    pub name: [::std::os::raw::c_char; 256usize],
    pub __bindgen_padding_0: [u64; 6usize],
    pub ctrl_ctx: MachnetChannelCtrlCtx_t,
    pub data_ctx: MachnetChannelDataCtx_t,
    pub app_buffer_cache: MachnetChannelAppBufferCache_t,
}
#[test]
fn bindgen_test_layout_MachnetChannelCtx() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetChannelCtx> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetChannelCtx>(),
        832usize,
        concat!("Size of: ", stringify!(MachnetChannelCtx))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetChannelCtx>(),
        64usize,
        concat!("Alignment of ", stringify!(MachnetChannelCtx))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).magic) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(magic)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).version) as usize - ptr as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(version)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).size) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(size)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).name) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(name)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).ctrl_ctx) as usize - ptr as usize },
        320usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(ctrl_ctx)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).data_ctx) as usize - ptr as usize },
        384usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(data_ctx)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).app_buffer_cache) as usize - ptr as usize },
        512usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetChannelCtx),
            "::",
            stringify!(app_buffer_cache)
        )
    );
}
#[doc = " The `MachnetChannelCtx' holds all the metadata information (context) of an\n Machnet Channel.\n\n It is always located at the beginning of the shared memory area."]
pub type MachnetChannelCtx_t = MachnetChannelCtx;
#[doc = " @brief Descriptor for SG data that constitute a message.\n\n This structure resembles `struct iovec` (check writev(2))."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MachnetIovec {
    #[doc = "< Pointer to the beginning of the SG data."]
    pub base: *mut ::std::os::raw::c_void,
    #[doc = "< Length of the SG data."]
    pub len: usize,
}
#[test]
fn bindgen_test_layout_MachnetIovec() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetIovec> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetIovec>(),
        16usize,
        concat!("Size of: ", stringify!(MachnetIovec))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetIovec>(),
        8usize,
        concat!("Alignment of ", stringify!(MachnetIovec))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).base) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetIovec),
            "::",
            stringify!(base)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).len) as usize - ptr as usize },
        8usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetIovec),
            "::",
            stringify!(len)
        )
    );
}
#[doc = " @brief Descriptor for SG data that constitute a message.\n\n This structure resembles `struct iovec` (check writev(2))."]
pub type MachnetIovec_t = MachnetIovec;
#[doc = " @brief Descriptor for a message.\n\n This structure resembles `struct msghdr`, but with a few adjustments:\n - `msg_size` is the total size of the message payload.\n - `peer_addr` is the address of the network peer that is the recipient or\n    sender of the message (depending on the direction).\n - `msg_iov` is a vector of `msg_iovlen` `MachnetIovec_t` structures.\n - `msg_iovlen` is the number of `MachnetIovec_t` structures in `msg_iov`.\n - `flags` is the message flags."]
#[repr(C)]
#[derive(Debug, Copy, Clone)]
pub struct MachnetMsgHdr {
    pub msg_size: u32,
    pub flow_info: MachnetFlow_t,
    pub msg_iov: *mut MachnetIovec_t,
    pub msg_iovlen: usize,
    pub flags: u16,
}
#[test]
fn bindgen_test_layout_MachnetMsgHdr() {
    const UNINIT: ::std::mem::MaybeUninit<MachnetMsgHdr> = ::std::mem::MaybeUninit::uninit();
    let ptr = UNINIT.as_ptr();
    assert_eq!(
        ::std::mem::size_of::<MachnetMsgHdr>(),
        40usize,
        concat!("Size of: ", stringify!(MachnetMsgHdr))
    );
    assert_eq!(
        ::std::mem::align_of::<MachnetMsgHdr>(),
        8usize,
        concat!("Alignment of ", stringify!(MachnetMsgHdr))
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).msg_size) as usize - ptr as usize },
        0usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetMsgHdr),
            "::",
            stringify!(msg_size)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).flow_info) as usize - ptr as usize },
        4usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetMsgHdr),
            "::",
            stringify!(flow_info)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).msg_iov) as usize - ptr as usize },
        16usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetMsgHdr),
            "::",
            stringify!(msg_iov)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).msg_iovlen) as usize - ptr as usize },
        24usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetMsgHdr),
            "::",
            stringify!(msg_iovlen)
        )
    );
    assert_eq!(
        unsafe { ::std::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
        32usize,
        concat!(
            "Offset of field: ",
            stringify!(MachnetMsgHdr),
            "::",
            stringify!(flags)
        )
    );
}
#[doc = " @brief Descriptor for a message.\n\n This structure resembles `struct msghdr`, but with a few adjustments:\n - `msg_size` is the total size of the message payload.\n - `peer_addr` is the address of the network peer that is the recipient or\n    sender of the message (depending on the direction).\n - `msg_iov` is a vector of `msg_iovlen` `MachnetIovec_t` structures.\n - `msg_iovlen` is the number of `MachnetIovec_t` structures in `msg_iov`.\n - `flags` is the message flags."]
pub type MachnetMsgHdr_t = MachnetMsgHdr;
extern "C" {
    #[doc = " @brief Initializes the Machnet library for the application, which is used\n to interact with the Machnet service on the machine.\n\n @return 0 on success, -1 on failure."]
    pub fn machnet_init() -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " @brief NOT part of the public API.\n\n This is a helper function used to bind to a shared memory segment from\n the application. The Machnet controller is going to hand over an open file\n descriptor to the appropriate shared memory segment. Internally, this\n function is resolving the size of the shared memory segment, and memory maps\n it to the process address space of the caller (application).\n\n @param shm_fd Open file descriptor for the shared memory segment.\n @param channel_size Pointer to a `size_t` variable that will be filled with\n the size of the channel. This is optional and can be `NULL`.\n @return A pointer to the mapped channel on success, `NULL` otherwise."]
    pub fn machnet_bind(
        shm_fd: ::std::os::raw::c_int,
        channel_size: *mut usize,
    ) -> *mut MachnetChannelCtx_t;
}
extern "C" {
    #[doc = " @brief Creates a new channel to the Machnet controller and binds to it. A\n channel is a logical entity between an application and the Machnet service.\n\n @return A pointer to the channel context on success, NULL otherwise."]
    pub fn machnet_attach() -> *mut ::std::os::raw::c_void;
}
extern "C" {
    #[doc = " @brief Listens for incoming messages on a specific IP and port.\n @param[in] channel The channel associated to the listener.\n @param[in] ip The local IP address to listen on.\n @param[in] port The local port to listen on.\n @return 0 on success, -1 on failure."]
    pub fn machnet_listen(
        channel_ctx: *mut ::std::os::raw::c_void,
        local_ip: *const ::std::os::raw::c_char,
        port: u16,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " @brief Creates a new connection to a remote peer.\n @param[in] channel     The channel associated with the connection.\n @param[in] local_ip    The local IP address.\n @param[in] remote_ip   The remote IP address.\n @param[in] remote_port The remote port.\n @param[out] flow       A pointer to a `MachnetFlow_t` structure that will be\n                        filled by the function upon success.\n @return  0 on success, -1 on failure. `flow` is filled with the flow\n information on success."]
    pub fn machnet_connect(
        channel_ctx: *mut ::std::os::raw::c_void,
        local_ip: *const ::std::os::raw::c_char,
        remote_ip: *const ::std::os::raw::c_char,
        remote_port: u16,
        flow: *mut MachnetFlow_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Enqueue one message for transmission to a remote peer over the network.\n\n @param[in] channel_ctx The Machnet channel context\n @param[in] flow The pre-created flow to the remote peer\n @param[in] buf The data buffer to send to the remote peer\n @param[in] len The length of the data buffer in bytes"]
    pub fn machnet_send(
        channel_ctx: *const ::std::os::raw::c_void,
        flow: MachnetFlow_t,
        buf: *const ::std::os::raw::c_void,
        len: usize,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " This function enqueues one message for transmission to a remote peer over\n the network. The application needs to provide the destination's (remote\n peer) address. Machnet is responsible for end-to-end encrypted, reliable\n delivery of each message to the relevant receiver. This function supports\n SG collection of a message's buffers from the application's address\n space.\n\n @param[in] channel_ctx        The Machnet channel context\n @param[in] msghdr             An `MachnetMsgHdr' descriptor\n @return                   0 on success, -1 on failure"]
    pub fn machnet_sendmsg(
        channel_ctx: *const ::std::os::raw::c_void,
        msghdr: *const MachnetMsgHdr_t,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " This function sends one or more messages to a remote peer over the network.\n The application needs to provide the destination's (remote peer) address.\n Machnet is responsible for end-to-end encrypted, reliable delivery of each\n message to the relevant receiver. This function supports SG collection of a\n message's buffers from the application's address space.\n\n @param[in] channel_ctx        The Machnet channel context\n @param[in] msghdr_iovec       An array of `MachnetMsgHdr' descriptors, each\n one describing a standalone TX message.\n @param[in] vlen               Length of the `msghdr_iovec' array (number of\n                               messages to be sent).\n @return                       # of messages sent."]
    pub fn machnet_sendmmsg(
        channel_ctx: *const ::std::os::raw::c_void,
        msghdr_iovec: *const MachnetMsgHdr_t,
        vlen: ::std::os::raw::c_int,
    ) -> ::std::os::raw::c_int;
}
extern "C" {
    #[doc = " Receive a pending message from some remote peer over the network.\n\n @param[in] channel_ctx The Machnet channel context\n @param[out] buf The data buffer to receive the message\n @param[in] len The length of \\p buf in bytes\n @param[out] flow The flow information of the sender\n\n @return 0 if no message is available, -1 on failure, otherwise the number of\n bytes received."]
    pub fn machnet_recv(
        channel_ctx: *const ::std::os::raw::c_void,
        buf: *mut ::std::os::raw::c_void,
        len: usize,
        flow: *mut MachnetFlow_t,
    ) -> isize;
}
extern "C" {
    #[doc = " This function receives a pending message (destined to the application) from\n the Machnet Channel. The application is responsible from providing an\n appropriate msghdr, which describes the locations of the buffers (SG is\n supported) to which the message should be copied to. The sender's network\n information can be found in the `flow_info` field of the msghdr.\n\n @param[in] ctx                The Machnet channel context\n @param[in, out] msghdr        An `MachnetMsgHdr' descriptor. The application\n                               needs to fill in the `msg_iov` and `msg_iovlen`\n                               members, which describe the locations of the\n                               buffers to which the message should be copied\n                               to. The `flow_info` member is set by Machnet to\n                               indicate the flow that the message belongs to.\n @return                       0 if no pending message, 1 if a message is\n                               received, -1 on failure"]
    pub fn machnet_recvmsg(
        channel_ctx: *const ::std::os::raw::c_void,
        msghdr: *mut MachnetMsgHdr_t,
    ) -> ::std::os::raw::c_int;
}