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
//! This module contains the macros
//! for creating offer functions for three
//! of participants, whatever are their name.
//!
//! *This module is available only if MultiCrusty is built with
//! the `"macros_simple"` feature.*

/// Create an *offer* function to recv on the first binary
/// session from any kind of role.  Must be used with
/// [`MeshedChannels`].
///
/// # Arguments
///
/// * The name of the new *offer* function
/// * The name of the dual of the broadcasting sender
/// * The name of the receiver
///
/// # Example
///
/// ```
/// use mpstthree::functionmpst::OfferMpst;
/// use mpstthree::meshedchannels::MeshedChannels;
/// use mpstthree::{
///     create_broadcast_role, create_normal_name, create_normal_role, create_offer_mpst_session_1,
/// };
///
/// create_normal_role!(RoleA, RoleADual);
/// create_normal_role!(RoleC, RoleCDual);
/// create_normal_name!(NameC);
/// create_broadcast_role!(RoleAlltoA, RoleAtoAll);
///
/// create_offer_mpst_session_1!(offer_mpst_session_c_to_a, RoleAlltoA, NameC);
/// ```
///
/// [`MeshedChannels`]:.crate::meshedchannels::MeshedChannels.
///
/// *This macro is available only if MultiCrusty is built with
/// the `"macros_simple"` feature.*
#[macro_export]
#[cfg_attr(doc_cfg, doc(cfg(feature = "macros_simple")))]
macro_rules! create_offer_mpst_session_1 {
    ($func_name:ident, $role:ident, $name:ident) => {
        mpst_seq_proc::create_offer_mpst_session_multi!(
            $func_name,
            OfferMpst,
            $role,
            $name,
            MeshedChannels,
            3,
            1
        );
    };
}

/// Create an *offer* function to recv on the second binary
/// session from any kind of role.  Must be used with
/// [`MeshedChannels`].
///
/// # Arguments
///
/// * The name of the new *offer* function
/// * The name of the dual of the broadcasting sender
/// * The name of the receiver
///
/// # Example
///
/// ```
/// use mpstthree::functionmpst::OfferMpst;
/// use mpstthree::meshedchannels::MeshedChannels;
/// use mpstthree::{
///     create_broadcast_role, create_normal_name, create_normal_role, create_offer_mpst_session_2,
/// };
///
/// create_normal_role!(RoleA, RoleADual);
/// create_normal_role!(RoleC, RoleCDual);
/// create_normal_name!(NameA);
/// create_broadcast_role!(RoleAlltoC, RoleCtoAll);
///
/// create_offer_mpst_session_2!(offer_mpst_session_a_to_c, RoleAlltoC, NameA);
/// ```
///
/// [`MeshedChannels`]: crate::meshedchannels::MeshedChannels
///
/// *This macro is available only if MultiCrusty is built with
/// the `"macros_simple"` feature.*
#[macro_export]
#[cfg_attr(doc_cfg, doc(cfg(feature = "macros_simple")))]
macro_rules! create_offer_mpst_session_2 {
    ($func_name:ident, $role:ident, $name:ident) => {
        mpst_seq_proc::create_offer_mpst_session_multi!(
            $func_name,
            OfferMpst,
            $role,
            $name,
            MeshedChannels,
            3,
            2
        );
    };
}