New option for isdnrate: `-rvNN' requires a vbn starting with NN.

Suggested by Thomas Richter on isdn4linux mailinglist, for reference see
http://listserv.isdn4linux.de/pipermail/isdn4linux/2003-September/000011.html
This commit is contained in:
tobiasb 2003-09-04 19:45:07 +00:00
parent 679d77c3d7
commit ceea8a9948
2 changed files with 31 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $Id: isdnrate.c,v 1.39 2002/08/15 17:22:43 akool Exp $
/* $Id: isdnrate.c,v 1.40 2003/09/04 19:45:07 tobiasb Exp $
* ISDN accounting for isdn4linux. (rate evaluation)
*
@ -19,6 +19,11 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* $Log: isdnrate.c,v $
* Revision 1.40 2003/09/04 19:45:07 tobiasb
* New option for isdnrate: `-rvNN' requires a vbn starting with NN.
* Suggested by Thomas Richter on isdn4linux mailinglist, for reference see
* http://listserv.isdn4linux.de/pipermail/isdn4linux/2003-September/000011.html
*
* Revision 1.39 2002/08/15 17:22:43 akool
* isdnlog-4.63
* - new rates/provider ...
@ -310,7 +315,7 @@
static void print_header(void);
static char *myname, *myshortname;
static char options[] = "ab:d:f:h:l:op:st:v::x:CD::G:HLNP:O:S:TUVX::Z";
static char options[] = "ab:d:f:h:l:op:r:st:v::x:CD::G:HLNP:O:S:TUVX::Z";
static char usage[] = "%s: usage: %s [ -%s ] Destination ...\n";
static int header = 0, best = MAXPROVIDER, table = 0, explain = 0;
@ -333,6 +338,7 @@ static int xbusiness = 0;
static int all = 0;
static int booked = 0;
static int service = 0;
static char *require_vbn = NULL;
#define SOCKNAME "/tmp/isdnrate"
static int is_daemon = 0;
@ -598,6 +604,11 @@ static int opts(int argc, char *argv[])
}
break;
case 'r': /* require certain providers properties */
if (optarg[0]=='v') /* only (start of) vbn supported so far */
require_vbn = strdup(optarg+1);
break;
case 'v':
verbose++;
if (optarg && (x = atoi(optarg)))
@ -914,6 +925,9 @@ static int compute(char *num)
continue;
if (!all && !isProviderValid(i, start))
continue;
if ( require_vbn &&
strncmp(getProviderVBN(i), require_vbn, strlen(require_vbn)) )
continue;
t = getProvider(i);
if (!t || t[strlen(t) - 1] == '?') /* UNKNOWN Provider */
continue;
@ -1780,6 +1794,7 @@ int main(int argc, char *argv[], char *envp[])
print_msg(PRT_A, "\t-l duration\tduration of call in seconds (default %d seconds)\n", LCR_DURATION);
print_msg(PRT_A, "\t-o \t show only booked providers\n");
print_msg(PRT_A, "\t-p prov|B[,prov...]\t show only these providers\n");
print_msg(PRT_A, "\t-r vNN\tonly providers whose vbn begins with <NN>\n");
print_msg(PRT_A, "\t-s \t consider 'Destination' as a service name\n");
print_msg(PRT_A, "\t-t takt\t\tshow providers if chargeduration<=takt\n");
print_msg(PRT_A, "\t-v [level]\tverbose\n");

View File

@ -1,11 +1,12 @@
.\" CHECKIN $Date: 2000/09/01 12:35:44 $
.\" CHECKIN $Date: 2003/09/04 19:45:07 $
.TH ISDNRATE 1 "@MANDATE@" -lt-
.SH NAME
isdnrate \- Print telefon rates and various info from rate\-files(5).
.SH SYNOPSIS
.BI "isdnrate \-b" best " \-d" day " \-f" from " \-h" hour " \-l" len
.B \-o
.BI \-p provs
.BI "\-p" provs " \-r"
.I \fPv\fINN
.B \-s
.BI "\-t" takt " \-v" verbose " \-x" exclude
.BI " \-C \-D" det " -\G" data " \-H \-L \-N \-O" socketfile " \-P" piddir
@ -107,6 +108,10 @@ if there are more variations, or
.I B
for business providers.
.P
\fB\-r\fPv\fINN\fP
Show only providers whose vbn begins with \fINN\fP.
The vbn is also known as provider prefix consisting of VBN and provider number.
.P
.B \-s
Consider
.B NUMBER
@ -267,6 +272,13 @@ for a connection length of 2 Minutes.
Show rates and zones for destination USA for providers
.IR "1_2 " and " 24" .
.P
.I isdnrate -C -l60 -rv010 HAM
.br
Show rates for a one minute call to Hamburg (HAM: airport code) and
use only providers whose vbn begins with 010.
So provider A with vbn 01030 is displayed,
provider B with vbn 0190023 is not.
.P
.I isdnrate -CX -H -dW -b5 US CA
.br
Show a header, rates and zones for destinations USA and Canada for best 5