0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037 #ifndef _TIPC_LINK_H
0038 #define _TIPC_LINK_H
0039
0040 #include <net/genetlink.h>
0041 #include "msg.h"
0042 #include "node.h"
0043
0044
0045
0046 #define ELINKCONG EAGAIN
0047
0048
0049
0050 enum {
0051 LINK_ESTABLISH_EVT = 0xec1ab1e,
0052 LINK_PEER_RESET_EVT = 0x9eed0e,
0053 LINK_FAILURE_EVT = 0xfa110e,
0054 LINK_RESET_EVT = 0x10ca1d0e,
0055 LINK_FAILOVER_BEGIN_EVT = 0xfa110bee,
0056 LINK_FAILOVER_END_EVT = 0xfa110ede,
0057 LINK_SYNCH_BEGIN_EVT = 0xc1ccbee,
0058 LINK_SYNCH_END_EVT = 0xc1ccede
0059 };
0060
0061
0062
0063 enum {
0064 TIPC_LINK_UP_EVT = 1,
0065 TIPC_LINK_DOWN_EVT = (1 << 1),
0066 TIPC_LINK_SND_STATE = (1 << 2)
0067 };
0068
0069
0070
0071
0072 #define MAX_PKT_DEFAULT 1500
0073
0074 bool tipc_link_create(struct net *net, char *if_name, int bearer_id,
0075 int tolerance, char net_plane, u32 mtu, int priority,
0076 u32 min_win, u32 max_win, u32 session, u32 ownnode,
0077 u32 peer, u8 *peer_id, u16 peer_caps,
0078 struct tipc_link *bc_sndlink,
0079 struct tipc_link *bc_rcvlink,
0080 struct sk_buff_head *inputq,
0081 struct sk_buff_head *namedq,
0082 struct tipc_link **link);
0083 bool tipc_link_bc_create(struct net *net, u32 ownnode, u32 peer, u8 *peer_id,
0084 int mtu, u32 min_win, u32 max_win, u16 peer_caps,
0085 struct sk_buff_head *inputq,
0086 struct sk_buff_head *namedq,
0087 struct tipc_link *bc_sndlink,
0088 struct tipc_link **link);
0089 void tipc_link_tnl_prepare(struct tipc_link *l, struct tipc_link *tnl,
0090 int mtyp, struct sk_buff_head *xmitq);
0091 void tipc_link_create_dummy_tnl_msg(struct tipc_link *tnl,
0092 struct sk_buff_head *xmitq);
0093 void tipc_link_failover_prepare(struct tipc_link *l, struct tipc_link *tnl,
0094 struct sk_buff_head *xmitq);
0095 void tipc_link_build_reset_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
0096 int tipc_link_fsm_evt(struct tipc_link *l, int evt);
0097 bool tipc_link_is_up(struct tipc_link *l);
0098 bool tipc_link_peer_is_down(struct tipc_link *l);
0099 bool tipc_link_is_reset(struct tipc_link *l);
0100 bool tipc_link_is_establishing(struct tipc_link *l);
0101 bool tipc_link_is_synching(struct tipc_link *l);
0102 bool tipc_link_is_failingover(struct tipc_link *l);
0103 bool tipc_link_is_blocked(struct tipc_link *l);
0104 void tipc_link_set_active(struct tipc_link *l, bool active);
0105 void tipc_link_reset(struct tipc_link *l);
0106 void tipc_link_reset_stats(struct tipc_link *l);
0107 int tipc_link_xmit(struct tipc_link *link, struct sk_buff_head *list,
0108 struct sk_buff_head *xmitq);
0109 struct sk_buff_head *tipc_link_inputq(struct tipc_link *l);
0110 u16 tipc_link_rcv_nxt(struct tipc_link *l);
0111 u16 tipc_link_acked(struct tipc_link *l);
0112 u32 tipc_link_id(struct tipc_link *l);
0113 char *tipc_link_name(struct tipc_link *l);
0114 u32 tipc_link_state(struct tipc_link *l);
0115 char tipc_link_plane(struct tipc_link *l);
0116 int tipc_link_prio(struct tipc_link *l);
0117 int tipc_link_min_win(struct tipc_link *l);
0118 int tipc_link_max_win(struct tipc_link *l);
0119 void tipc_link_update_caps(struct tipc_link *l, u16 capabilities);
0120 bool tipc_link_validate_msg(struct tipc_link *l, struct tipc_msg *hdr);
0121 unsigned long tipc_link_tolerance(struct tipc_link *l);
0122 void tipc_link_set_tolerance(struct tipc_link *l, u32 tol,
0123 struct sk_buff_head *xmitq);
0124 void tipc_link_set_prio(struct tipc_link *l, u32 prio,
0125 struct sk_buff_head *xmitq);
0126 void tipc_link_set_abort_limit(struct tipc_link *l, u32 limit);
0127 void tipc_link_set_queue_limits(struct tipc_link *l, u32 min_win, u32 max_win);
0128 int __tipc_nl_add_link(struct net *net, struct tipc_nl_msg *msg,
0129 struct tipc_link *link, int nlflags);
0130 int tipc_nl_parse_link_prop(struct nlattr *prop, struct nlattr *props[]);
0131 int tipc_link_timeout(struct tipc_link *l, struct sk_buff_head *xmitq);
0132 int tipc_link_rcv(struct tipc_link *l, struct sk_buff *skb,
0133 struct sk_buff_head *xmitq);
0134 int tipc_link_build_state_msg(struct tipc_link *l, struct sk_buff_head *xmitq);
0135 void tipc_link_add_bc_peer(struct tipc_link *snd_l,
0136 struct tipc_link *uc_l,
0137 struct sk_buff_head *xmitq);
0138 void tipc_link_remove_bc_peer(struct tipc_link *snd_l,
0139 struct tipc_link *rcv_l,
0140 struct sk_buff_head *xmitq);
0141 int tipc_link_bc_peers(struct tipc_link *l);
0142 void tipc_link_set_mtu(struct tipc_link *l, int mtu);
0143 int tipc_link_mtu(struct tipc_link *l);
0144 int tipc_link_mss(struct tipc_link *l);
0145 u16 tipc_get_gap_ack_blks(struct tipc_gap_ack_blks **ga, struct tipc_link *l,
0146 struct tipc_msg *hdr, bool uc);
0147 int tipc_link_bc_ack_rcv(struct tipc_link *l, u16 acked, u16 gap,
0148 struct tipc_gap_ack_blks *ga,
0149 struct sk_buff_head *xmitq,
0150 struct sk_buff_head *retrq);
0151 void tipc_link_build_bc_sync_msg(struct tipc_link *l,
0152 struct sk_buff_head *xmitq);
0153 void tipc_link_bc_init_rcv(struct tipc_link *l, struct tipc_msg *hdr);
0154 int tipc_link_bc_sync_rcv(struct tipc_link *l, struct tipc_msg *hdr,
0155 struct sk_buff_head *xmitq);
0156 int tipc_link_bc_nack_rcv(struct tipc_link *l, struct sk_buff *skb,
0157 struct sk_buff_head *xmitq);
0158 bool tipc_link_too_silent(struct tipc_link *l);
0159 struct net *tipc_link_net(struct tipc_link *l);
0160 #endif