[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[altq:1842] Re: Problems with QCMD API
On Wednesday 11 June 2003 13:26, you wrote:
Hi Kenjiro!
Firstly, I'm sorry for any simple questions. I'm not a great programmer in C
language, and maybe I'm asking something basic to you.
> > When I run the program, I got the message: "bad interface: enable
> > failed!". This message is printed by qcmd_enable function.
>
> - you need to call qcmd_init() first.
I added this function before to call qcmd_enable(ifname). But the result was
the same. I got the messages:
"ALTQ config file is /etc/altq.conf
bad interface: enable failed!"
The ifname variable is equal a "ed0" (char ifname[] = "ed0"), and there is a
network interface called ed0 in my system.
I didn't call this function (qcmd_init()) before, because I would like to
enable only one interface and not all of them.
> - ALTQ assumes that classes can be dynamically added but does not
> assume interfaces can be added after ALTQ is enabled...
I couldn't understant very well your explanation above. What do you want to
tell about "ALTQ doesn't assume interfaces can be added after ALTQ is
enabled..."?
About your explanation, I can deduce that if my /etc/altq.conf file is
'empty' and the qcmd_enableall() funcion enables all interfaces in my
machine, then couldn't I add an interface after? Is that?
Kenjiro, do you see some problem in the program below?
The ideia of this program is to enable ALTQ on "ed0" interface network and to
add a token bucket regulator through qcmd_cbq_add_if(ifname, bw, is_wrr,
eff)) function. After, classes and filters would be added.
#include <sys/param.h>
#include <altq/altq.h>
#include <stdio.h>
#include <errno.h>
#include <syslog.h>
#include <stdarg.h>
#include <string.h>
#include <math.h>
#include <libaltq/altq_qop.h>
#include <libaltq/qop_cbq.h>
#include <libaltq/qop_priq.h>
/* from rsvp_main.c */
char *altqconfigfile = "/etc/altq.conf";
#define CBQ_DEVICE "/dev/altq/cbq"
/* from rsvp_global.h */
int if_num; /* number of phyints */
int m_debug; /* Debug output control bits */
int l_debug; /* Logging severity level */
int daemonize = 0;
int main(int argc, char *argv[])
{
char ifname[] = "ed0";
int valor, bw, is_wrr, eff;
l_debug = 6;
bw = 10000000;
is_wrr = 1;
eff = 0;
qcmd_init();
if (argv[1] != NULL)
{
if (strcmp(argv[1],"enable")==0)
{
qcmd_enable(ifname);
if ((valor = qcmd_cbq_add_if(ifname, bw, is_wrr, eff)) != 0)
printf("ERROR\n");
else
printf("OK\n");
qcmd_cbq_add_class(ifname, "root_class", NULL, NULL, 0, 10000, NU
LL, NULL, NULL, NULL, NULL, NULL, NULL);
}
}
return 0;
}