123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215 |
- #ifndef _TIPC_BEARER_H
- #define _TIPC_BEARER_H
- #include "bcast.h"
- #define MAX_BEARERS 8
- #define MAX_MEDIA 4
- #define TIPC_MEDIA_TYPE_ETH 1
- struct tipc_media_addr {
- __be32 type;
- union {
- __u8 eth_addr[6];
- } dev_addr;
- };
- struct tipc_bearer;
- struct media {
- int (*send_msg)(struct sk_buff *buf,
- struct tipc_bearer *b_ptr,
- struct tipc_media_addr *dest);
- int (*enable_bearer)(struct tipc_bearer *b_ptr);
- void (*disable_bearer)(struct tipc_bearer *b_ptr);
- char *(*addr2str)(struct tipc_media_addr *a,
- char *str_buf, int str_size);
- struct tipc_media_addr bcast_addr;
- u32 priority;
- u32 tolerance;
- u32 window;
- u32 type_id;
- char name[TIPC_MAX_MEDIA_NAME];
- };
- struct tipc_bearer {
- void *usr_handle;
- u32 mtu;
- int blocked;
- struct tipc_media_addr addr;
- char name[TIPC_MAX_BEARER_NAME];
- spinlock_t lock;
- struct media *media;
- u32 priority;
- u32 identity;
- struct link_req *link_req;
- struct list_head links;
- struct list_head cong_links;
- u32 continue_count;
- int active;
- char net_plane;
- struct tipc_node_map nodes;
- };
- struct bearer_name {
- char media_name[TIPC_MAX_MEDIA_NAME];
- char if_name[TIPC_MAX_IF_NAME];
- };
- struct link;
- extern struct tipc_bearer tipc_bearers[];
- int tipc_register_media(u32 media_type,
- char *media_name, int (*enable)(struct tipc_bearer *),
- void (*disable)(struct tipc_bearer *),
- int (*send_msg)(struct sk_buff *,
- struct tipc_bearer *, struct tipc_media_addr *),
- char *(*addr2str)(struct tipc_media_addr *a,
- char *str_buf, int str_size),
- struct tipc_media_addr *bcast_addr, const u32 bearer_priority,
- const u32 link_tolerance,
- const u32 send_window_limit);
- void tipc_recv_msg(struct sk_buff *buf, struct tipc_bearer *tb_ptr);
- int tipc_block_bearer(const char *name);
- void tipc_continue(struct tipc_bearer *tb_ptr);
- int tipc_enable_bearer(const char *bearer_name, u32 disc_domain, u32 priority);
- int tipc_disable_bearer(const char *name);
- int tipc_eth_media_start(void);
- void tipc_eth_media_stop(void);
- void tipc_media_addr_printf(struct print_buf *pb, struct tipc_media_addr *a);
- struct sk_buff *tipc_media_get_names(void);
- struct sk_buff *tipc_bearer_get_names(void);
- void tipc_bearer_add_dest(struct tipc_bearer *b_ptr, u32 dest);
- void tipc_bearer_remove_dest(struct tipc_bearer *b_ptr, u32 dest);
- void tipc_bearer_schedule(struct tipc_bearer *b_ptr, struct link *l_ptr);
- struct tipc_bearer *tipc_bearer_find_interface(const char *if_name);
- int tipc_bearer_resolve_congestion(struct tipc_bearer *b_ptr, struct link *l_ptr);
- int tipc_bearer_congested(struct tipc_bearer *b_ptr, struct link *l_ptr);
- void tipc_bearer_stop(void);
- void tipc_bearer_lock_push(struct tipc_bearer *b_ptr);
- static inline int tipc_bearer_send(struct tipc_bearer *b_ptr,
- struct sk_buff *buf,
- struct tipc_media_addr *dest)
- {
- return !b_ptr->media->send_msg(buf, b_ptr, dest);
- }
- #endif
|