[Olsr-cvs] olsrd-current/lib/dot_draw/src olsrd_dot_draw.c, 1.34, 1.35
Bernd Petrovitsch
(spam-protected)
Thu Nov 29 01:49:42 CET 2007
- Previous message: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.26,1.27
- Next message: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.12, 1.13 olsrd_conf.c, 1.62, 1.63 oparse.y, 1.39, 1.40 oscan.lex, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /cvsroot/olsrd/olsrd-current/lib/dot_draw/src
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16024/lib/dot_draw/src
Modified Files:
olsrd_dot_draw.c
Log Message:
Major Changes:
- renamed "struct local_hna_entry" to "struct ip_prefix_list" since
it is exactly that. Renamed the functions in src/local_hna_set.{c,h}
in the same way.
- each IPv4 and IPv6 function pairs in src/local_hna_set.{c,h} is
called from the same place and have the same signature. So I
condensed each of them.
- Since we have only 3 functions left in src/local_hna_set.{c,h}
and they are used for the configuration, the .h file is now part
of src/olsr_cfg.h and the ,c file of src/cfgparser/olsrd_conf.c.
- replaced "struct ipc_net" with "struct ip_prefix_list" since it
serves the same purpose as the "struct ip_prefix_list"
- replaced "struct ipc_host" with "struct ip_prefix_list" since it
serves the same purpose as the "struct ip_prefix_list" and is
just a special case. No need to duplicate code etc.
- removed "union hna_netmask" from src/olsr_types since we use the
prefix_len everywhere (and that is an olsr_u8_t in several other
struct's).
That implies changes and simplifications in the code handling
them (since the IPv4 is similar to IPv6).
- the config file parser now understands for IPv4 addresses also
"/$prefix".
- On the output side, the patch generates only "/$prefix" which
kills code since it is the same as the IPv6 handling.
- There are some netmask conversions left (mainly in the plugins)
but that be cleaned up afterwards.
- extracted ip{,4,6}{cmp,equal} and formatting functions from
net_olsr.{c,h} into src/ipcalc.{c,h} since net_olsr.h became
IMHO to much of a "put anything in there".
- renamed "sockaddr_to_string()" to "sockaddr4_to_string()"
since it is exactly that (unless I'm missing something).
Minor Changes:
- lib/httpinfo/src/admin_html.h contained just some variable
definitions so it is now integrated in the only user:
admin_interface.c
- olsrd_dot_draw.c got rid of two indicator variables if
a socket is valid or not. Since sockets may use "-1" as the
"not open", "invalid" value, there is no need for two more
ints.
- and the dot_draw plugin is somewhat smaller and easier to read.
- const'ified some functions
Index: olsrd_dot_draw.c
===================================================================
RCS file: /cvsroot/olsrd/olsrd-current/lib/dot_draw/src/olsrd_dot_draw.c,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** olsrd_dot_draw.c 29 Nov 2007 00:34:22 -0000 1.34
--- olsrd_dot_draw.c 29 Nov 2007 00:49:40 -0000 1.35
***************
*** 61,64 ****
--- 61,65 ----
#include "olsr.h"
+ #include "ipcalc.h"
#include "olsr_types.h"
#include "neighbor_table.h"
***************
*** 89,95 ****
plugin_ipc_init(void);
- static char*
- olsr_netmask_to_string(const union hna_netmask *mask);
-
/* Event function to register with the sceduler */
static int
--- 90,93 ----
***************
*** 106,110 ****
static void
! ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, const union hna_netmask *);
static void
--- 104,108 ----
static void
! ipc_print_net(const union olsr_ip_addr *, const union olsr_ip_addr *, olsr_u8_t);
static void
***************
*** 284,288 ****
struct tc_entry *tc;
struct tc_edge_entry *tc_edge;
! struct local_hna_entry *hna;
int idx;
--- 282,286 ----
struct tc_entry *tc;
struct tc_edge_entry *tc_edge;
! struct ip_prefix_list *hna;
int idx;
***************
*** 316,320 ****
ipc_print_net(&tmp_hna->A_gateway_addr,
&tmp_net->A_network_addr,
! &tmp_net->A_netmask);
}
}
--- 314,318 ----
ipc_print_net(&tmp_hna->A_gateway_addr,
&tmp_net->A_network_addr,
! tmp_net->prefixlen);
}
}
***************
*** 323,338 ****
/* Local HNA entries */
for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) {
- union hna_netmask hna_msk;
- if (olsr_cnf->ip_version == AF_INET) {
- union olsr_ip_addr netmask;
- //hna_msk.v4 = hna4->netmask.v4;
- olsr_prefix_to_netmask(&netmask, hna->net.prefix_len);
- hna_msk.v4 = netmask.v4.s_addr;
- } else {
- hna_msk.v6 = hna->net.prefix_len;
- }
ipc_print_net(&olsr_cnf->main_addr,
&hna->net.prefix,
! &hna_msk);
}
ipc_send_str("}\n\n");
--- 321,327 ----
/* Local HNA entries */
for (hna = olsr_cnf->hna_entries; hna != NULL; hna = hna->next) {
ipc_print_net(&olsr_cnf->main_addr,
&hna->net.prefix,
! hna->net.prefix_len);
}
ipc_send_str("}\n\n");
***************
*** 360,375 ****
static void
! ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, const union hna_netmask *mask)
{
struct ipaddr_str gwbuf, netbuf;
! ipc_send_fmt("\"%s\" -> \"%s/%s\"[label=\"HNA\"];\n",
olsr_ip_to_string(&gwbuf, gw),
olsr_ip_to_string(&netbuf, net),
! olsr_netmask_to_string(mask));
! ipc_send_fmt("\"%s/%s\"[shape=diamond];\n",
olsr_ip_to_string(&netbuf, net),
! olsr_netmask_to_string(mask));
}
--- 349,364 ----
static void
! ipc_print_net(const union olsr_ip_addr *gw, const union olsr_ip_addr *net, olsr_u8_t prefixlen)
{
struct ipaddr_str gwbuf, netbuf;
! ipc_send_fmt("\"%s\" -> \"%s/%d\"[label=\"HNA\"];\n",
olsr_ip_to_string(&gwbuf, gw),
olsr_ip_to_string(&netbuf, net),
! prefixlen);
! ipc_send_fmt("\"%s/%d\"[shape=diamond];\n",
olsr_ip_to_string(&netbuf, net),
! prefixlen);
}
***************
*** 403,422 ****
}
}
-
- static char*
- olsr_netmask_to_string(const union hna_netmask *mask)
- {
- char *ret;
- struct in_addr in;
-
- if (olsr_cnf->ip_version == AF_INET) {
- in.s_addr = mask->v4;
- ret = inet_ntoa(in);
- } else {
- /* IPv6 */
- static char netmask[5];
- sprintf(netmask, "%d", mask->v6);
- ret = netmask;
- }
- return ret;
- }
--- 392,393 ----
- Previous message: [Olsr-cvs] olsrd-current/lib/dyn_gw/src olsrd_dyn_gw.c,1.26,1.27
- Next message: [Olsr-cvs] olsrd-current/src/cfgparser cfgfile_gen.c, 1.12, 1.13 olsrd_conf.c, 1.62, 1.63 oparse.y, 1.39, 1.40 oscan.lex, 1.27, 1.28
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Olsr-cvs
mailing list