[openbeosnetteam] BONE components and interaction

  • From: Ksyu & Dima <k2d2@xxxxxxxxxxxxxxx>
  • To: openbeosnetteam@xxxxxxxxxxxxx
  • Date: Fri, 02 Nov 2001 12:14:20 -0400

Hi everybody,

I'm not sure if this is what Emmanuel and Jean had in mind, but hopefully this 
will of some help to us... ;-)
Most of the information in this diagram can be found at 
http://www-classic.be.com/aboutbe/benewsletter/volume_IV/Issue05.html.
The rest is contained in BE's bone.zip (if someone needs the archive I can 
e-mail it); I'm not entirely clear on how Data Link module should interface 
with framing module and ethernet (or whatever) driver; I made an attempt to 
list possible functions which an ethernet driver would have to implement by 
looking at the header files in BONE example.

Anyway, it is only a first approach so a lot of thnigs will change; Let me know 
if you have any suggestions, corrections, etc...

Enjoy,
Dmitri


                          _______________
                         |               |
                         | libsocket.so  |
                         |_______________|
user land                        |
- - - - - - - - - - - - - - - - -+- - - - - - - - - - - - -
kernel land                      |
                         ________|________
                        |                 |
    ______________      |  net api driver |
   |              |     |_________________|
   |   bone_util  |              |
   |______________|      ________|________
                        |                 |
network/transport       | protocol module | (e.g.,. udp)
layer                   |_________________|
                                 |
                         ________|________
                        |                 | (contains ARP,
data link layer         | datalink module | etc.)
                        |_________________|
                           /           \
             _____________/___         _\_______________
            |     loopback    |       |     802.3       |
            | framing module  |       |  framing module |
            |_________________|       |_________________|
                     |                         |
physical layer       |                         |
             ________|________         ________|________
            |                 |       |                 |
            | loopback driver |       | ethernet driver |
            |_________________|       |_________________|


- libsocket.so interfaces with user-land applications using Network Kit/Posix 
(BSD sockets) API;

- Net API driver is responsible for creating bone_endpoint_t structure and 
handles all communications between the socket and protocol stack.
Interfaces with libsocket.so via ioctls;

- Protocol module interfaces with Net API driver via (as found in bone_proto.h 
in bone.zip example):
status_t (*init_protocol)(struct bone_proto_node *you); - called when a new 
endpoint is created
status_t (*uninit_protocol)(struct bone_proto_node *you); - called when 
deleting an endpoint
status_t (*close)(struct bone_proto_node *you); - called when a user calls 
"close" on a socket
status_t (*connect)(struct bone_proto_node *you, struct sockaddr *them);
status_t (*send_data)(struct bone_proto_node *you, bone_data_t *data);
int32 (*send_avail)(struct bone_proto_node *you); - called to determine how 
many bytes can be sent without blocking
status_t (*read_data)(struct bone_proto_node *you, struct iovec *into, int 
numiov, int32 flags, bigtime_t timeout, struct sockaddr *addr, int len);
int32  (*read_avail)(struct bone_proto_node *you);- called to determine how 
many bytes can be read without blocking
status_t (*accept)(struct bone_proto_node *you, struct bone_proto_node *clone);
status_t (*bind)(struct bone_proto_node *you, struct sockaddr *sa);
status_t (*unbind)(struct bone_proto_node *you, struct sockaddr *sa); - I'm not 
sure about the purpose of this call
status_t (*listen)(struct bone_proto_node *you, int count);
status_t (*shutdown)(struct bone_proto_node *you, int direction); - closes our 
side of the connection
status_t (*control)(struct bone_proto_node *you, int level, int cmd, void *arg, 
int arglen); - called on ioctl or setsockopt
status_t (*error)(int32 error_code, bone_data_t *error_data); - interface for 
error reporting (ICMP)
status_t (*error_reply)(struct bone_proto_node *you, bone_data_t *caused_error, 
uint32 error_code, void *error_data); 
- interface for error replies (ICMP)
int32    (*getMTU)(struct bone_proto_node *you, struct sockaddr *sa); - get 
route MTU
route_t  (*get_route)(struct bone_proto_node *you, struct sockaddr *addr); - 
get route

-Protocol module interfaces with Data Link module via:
status_t (*receive_data)(bone_data_t *data);


-Datalink module - manages network interfaces, handles ARP operations:
void (*register_interface)(ifnet_t *ifnet);
status_t (*up)(ifnet_t *ifnet);
void (*down)(ifnet_t *ifnet);
status_t (*setMedia)(ifnet_t *ifnet, uint32 media);
status_t (*setPromiscuous)(ifnet_t *ifnet, int on);
status_t (*getHardwareAddr)(ifnet_t *ifnet, bone_iface_hwaddr_t *addr);

status_t (*send_data)(ifnet_t *ifnet, bone_data_t *data); - send data on the 
specified interface
status_t (*send_data_nonblocking)(ifnet_t *ifnet, bone_data_t *data);

-Framing module - ecapsulates into packet into a frame/decapsulates frame into 
a packet, performs checksum (FCS) calculations
-I'm not sure if this is all we need...
status_t (*frame_data)(ifnet_t *ifnet, bone_data_t *data);
status_t (*deframe_data)(ifnet_t *ifnet, bone_data_t *data);
void (*compute_fcs)(bone_data_t *data); - calculates FCS (frame check sequence)

-Physical layer [Ethernet] driver
status_t (*up)(void);
void (*down)(void);
status_t (*setMedia)(uint32 media);
status_t (*send_data)(bone_data_t *data);
status_t (*send_data_nonblocking)(bone_data_t *data);
status_t (*receive_data)(bone_data_t **data);
status_t (*setMTU)(uint32 mtu);
status_t (*setPromiscuous)(int on);
status_t (*getHardwareAddr)(bone_iface_hwaddr_t *addr);





Other related posts:

  • » [openbeosnetteam] BONE components and interaction