Kbit/s?
Martin Horcicka
horcicka at dzungle.ms.mff.cuni.cz
Mon May 28 18:49:52 CEST 2001
> > 1. 1Kbit/s = 1024 bitu/s
> > 2. 1Kbit/s = 1000 bitu/s
>
> > b. co pouziva dummynet/ipfw na FreeBSD?
>
> Pokud vim pouziva 1) - ale podivej se do zdrojaku.
Tuhle radu jsem cekal. :) Mrknul jsem do CVS na ipfw a prikladam kousek
kodu, ze ktereho je patrne, ze ipfw pouziva variantu 2 - a to dokonce i
pro kilobyty.
Diky za odpovedi.
Martin
...
/* some commands are only good for pipes. */
if (!strncmp(*av,"bw",strlen(*av)) ||
! strncmp(*av,"bandwidth",strlen(*av))) {
if (av[1][0]>='a' && av[1][0]<='z') {
int l = sizeof(pipe.if_name)-1 ;
/* interface name */
strncpy(pipe.if_name, av[1], l);
pipe.if_name[l] = '\0';
pipe.bandwidth = 0 ;
} else {
pipe.if_name[0] = '\0';
pipe.bandwidth = strtoul(av[1], &end, 0);
if (*end == 'K' || *end == 'k' )
end++, pipe.bandwidth *= 1000 ;
else if (*end == 'M')
end++, pipe.bandwidth *= 1000000 ;
if ( *end == 'B' || !strncmp(end, "by", 2) )
pipe.bandwidth *= 8 ;
}
av+=2; ac-=2;
} else if (!strncmp(*av,"delay",strlen(*av)) ) {
...
More information about the Users-l
mailing list