1 /*
2 *
3 * Copyright (c) 2004 The Regents of the University of California. All
4 * rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 *
10 * - Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 *
13 * - Neither the name of the University nor the names of its
14 * contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS''
18 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
19 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
20 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
21 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
22 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
23 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
24 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
25 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 */
30
31 #include "link/link.h"
32
33 #ifndef __LINK_MULTI_H__
34 #define __LINK_MULTI_H__
35
36 typedef struct _lu_multi_context lu_multi_context_t;
37 typedef struct _lu_multi_link lu_multi_link_t;
38
39 typedef int (*lu_multi_receive_cb_t)(lu_multi_link_t *lu_l, link_pkt_t *pkt, int data_len);
40 typedef void (*lu_multi_notify_cb_t)(lu_multi_context_t *lu_m, lu_multi_link_t *l);
41
42 typedef struct lu_multi_opts {
43 /* template options for new links */
44 lu_opts_t lu_opts;
45
46 /* specify a set of links: */
47 char *if_class; /* by interface class */
48 char *neighbors_list; /* comma-sep list of addl neighbors devs */
49
50 /* notification callbacks */
51 lu_multi_notify_cb_t new_link; /* new link opened */
52 lu_multi_notify_cb_t neighbor_change; /* neighbors change */
53 lu_multi_notify_cb_t status_notify; /* status arrived */
54 lu_multi_receive_cb_t receive; /* on packet arrival */
55
56 int withhold_warning; /* prevents warning about no links */
57 } lu_multi_opts_t;
58
59
60 /* opens multiple links based on link class */
61 int lu_open_multi(lu_multi_opts_t *opts, lu_multi_context_t **ref);
62 void lu_multi_destroy(lu_multi_context_t *lu);
63
64 /* multi send */
65 int lu_multi_send(lu_multi_context_t *lm, int interface, link_pkt_t *pkt, ssize_t data_len);
66 int lu_multi_get_if_id(lu_multi_context_t *lum, int interface, if_id_t *iid);
67
68 /*
69 * *** IMPORTANT *** don't use the underlying lu_context data pointer!
70 * this pointer is used internally by multi_link!
71 */
72
73 /* get the link user context */
74 lu_context_t *lu_multi_link_get_lu(lu_multi_link_t *l);
75
76 /* get/set private data from a 'multi link' */
77 void *lu_multi_link_get_data(lu_multi_link_t *l);
78 void lu_multi_link_set_data(lu_multi_link_t *l, void *);
79
80 /* get the index, name of a multi link */
81 int lu_multi_link_get_index(lu_multi_link_t *l);
82 char *lu_multi_link_get_name(lu_multi_link_t *l);
83
84 /* get the parent context of a multi link */
85 lu_multi_context_t *lu_multi_link_get_parent(lu_multi_link_t *l);
86 void *lu_multi_get_data(lu_multi_context_t *lm);
87
88 lu_multi_link_t *lu_multi_index_link(lu_multi_context_t *lu, int index);
89 lu_multi_link_t *lu_multi_lookup_link(lu_multi_context_t *lu, const char *name);
90
91 /* "ARP" feature..
92 * returns 0 if found and ACTIVE.
93 * returns 1 if found but not ACTIVE.
94 * returns -1 if not found */
95 int lu_multi_if_to_node(lu_multi_context_t *lu, if_id_t if_id, node_id_t *node_id);
96 int lu_multi_node_to_if(lu_multi_context_t *lu, node_id_t node_id, if_id_t *if_id, int *index);
97 int lu_multi_link_get_conn(lu_multi_link_t *l, if_id_t if_id);
98
99 /* iterator */
100 lu_multi_link_t *lu_multi_links_top(lu_multi_context_t *lu);
101 lu_multi_link_t *lu_multi_links_next(lu_multi_link_t *ptr);
102 int lu_multi_links_qlen(lu_multi_context_t *lu);
103
104 #endif
105
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more
information.