diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2011-10-07 13:37:34 -0400 |
---|---|---|
committer | Paul Gortmaker <paul.gortmaker@windriver.com> | 2011-12-27 11:33:27 -0500 |
commit | 4d163a326fa4868cce1bb75dd95855d40e5497c6 (patch) | |
tree | 7c126c2875c638bd85c7edc083c3f014a57b6a42 /net/tipc/bearer.h | |
parent | c61b666e260d5cc2e0203b21c689321e6ab0d676 (diff) | |
download | lwn-4d163a326fa4868cce1bb75dd95855d40e5497c6.tar.gz lwn-4d163a326fa4868cce1bb75dd95855d40e5497c6.zip |
tipc: Add new address conversion routines for Ethernet media
Enhances TIPC's Ethernet media support to provide 3 new address conversion
routines, which allow TIPC to interpret an address that is in string form
and to convert an address to and from the 20 byte format used in TIPC's
neighbor discovery messages.
These routines are pre-requisites to a follow on commit that hides all
media-specific addressing details from TIPC's generic bearer code.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Diffstat (limited to 'net/tipc/bearer.h')
-rw-r--r-- | net/tipc/bearer.h | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/net/tipc/bearer.h b/net/tipc/bearer.h index 4e9367f956a4..41a61d219c38 100644 --- a/net/tipc/bearer.h +++ b/net/tipc/bearer.h @@ -43,6 +43,17 @@ #define MAX_MEDIA 2 /* + * Identifiers associated with TIPC message header media address info + * + * - address info field is 20 bytes long + * - media type identifier located at offset 3 + * - remaining bytes vary according to media type + */ + +#define TIPC_MEDIA_ADDR_SIZE 20 +#define TIPC_MEDIA_TYPE_OFFSET 3 + +/* * Identifiers of supported TIPC media types */ #define TIPC_MEDIA_TYPE_ETH 1 @@ -68,7 +79,10 @@ struct tipc_bearer; * @send_msg: routine which handles buffer transmission * @enable_bearer: routine which enables a bearer * @disable_bearer: routine which disables a bearer - * @addr2str: routine which converts bearer's address to string form + * @addr2str: routine which converts media address to string + * @str2addr: routine which converts media address from string + * @addr2msg: routine which converts media address to protocol message area + * @msg2addr: routine which converts media address from protocol message area * @bcast_addr: media address used in broadcasting * @priority: default link (and bearer) priority * @tolerance: default time (in ms) before declaring link failure @@ -84,6 +98,9 @@ struct media { int (*enable_bearer)(struct tipc_bearer *b_ptr); void (*disable_bearer)(struct tipc_bearer *b_ptr); int (*addr2str)(struct tipc_media_addr *a, char *str_buf, int str_size); + int (*str2addr)(struct tipc_media_addr *a, char *str_buf); + int (*addr2msg)(struct tipc_media_addr *a, char *msg_area); + int (*msg2addr)(struct tipc_media_addr *a, char *msg_area); struct tipc_media_addr bcast_addr; u32 priority; u32 tolerance; |