/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 2002-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* Glenn Fowler <gsf@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* bgp ipma method
*
* Glenn Fowler
* AT&T Research
*/
#include "bgplib.h"
typedef struct Ipmastate_s
{
} Ipmastate_t;
/*
* ipma identf
*/
static int
{
register char* s;
register char* e;
register char* e1;
register char* e2;
s = (char*)buf;
e = s + n;
while (s < e)
{
if (s < e1 && strneq(s, magic1, sizeof(magic1) - 1) || s < e2 && strneq(s, magic2, sizeof(magic2) - 1))
return 1;
s++;
}
return 0;
}
/*
* ipma openf
*/
static int
{
register char* s;
register char* e;
register char* e1;
register char* e2;
register int c;
register int q;
{
return -1;
}
{
{
while (s < e)
{
if (s < e1 && strneq(s, magic1, sizeof(magic1) - 1) || s < e2 && strneq(s, magic2, sizeof(magic2) - 1))
break;
s++;
}
if (s < e)
break;
}
q = 0;
for (;;)
{
{
case EOF:
break;
case '\n':
q = 0;
continue;
case '0': case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8': case '9':
if (q == 0)
{
break;
}
continue;
case '<':
if (q == 0 || q == '&')
q = c;
continue;
case '>':
if (q == '<' || q == '&')
q = 0;
else if (q == 0)
q = '#';
continue;
case '&':
if (q == 0)
q = c;
continue;
default:
if (q == 0)
{
if (!isspace(c))
q = '#';
}
else if (q == '&')
{
if (!isalnum(c) && c != '#')
q = 0;
}
continue;
}
break;
}
}
return 0;
}
/*
* skip over html
* number==1 skips to next number
*/
static char*
{
register char* b;
register char* t;
do
{
b = s;
while (s < e && isspace(*s))
s++;
if (*s == '<')
{
while (s < e && *s++ != '>');
while (s < e && isspace(*s))
s++;
}
if (*s == '&')
{
if (*++s == '#' && s < e)
s++;
while (s < e && isalnum(*s))
s++;
}
if (s < e && number)
{
if ((isdigit(*s) || (e - s) > 5 && strneq(s, "local", 5)) && (isspace(*(s - 1)) || *(s - 1) == '>' || *(s - 1) == ';' || *(s - 1) == '='))
{
if (!isdigit(*s))
break;
for (t = s; t < e && isdigit(*t); t++);
break;
s = t;
}
{
s++;
break;
}
s++;
}
} while (s != b);
return s;
}
/*
* ipma readf
*/
static int
{
register char* s;
register int i;
int c;
int n;
int o;
char* e;
char* p;
for (;;)
{
return 0;
s = skip(s, e, 0);
if (s >= e)
continue;
if (isdigit(*s))
{
break;
s = skip(p, e, 1);
if (s >= e || !isalnum(*s))
{
break;
if (!isspace(c))
{
s = e = "";
}
return 0;
else
{
s = skip(s, e, 1);
}
}
}
else if ((e - s) > 6 && (strneq(s, "Prefix", 6) || strneq(s, "Networ", 6) || strneq(s, "Receiv", 6) || strneq(s, "Advert", 6)))
continue;
else
s = skip(s, e, 1);
if (s >= e)
break;
if (*(s - 1) == '=')
{
break;
s = skip(s, e, 1);
}
i = 0;
o = 0;
p = s;
do
{
for (s = p; *s == ' ' || *s == '\t' || *s == ','; s++);
if (*s == '{')
{
if (i >= (n - 2))
{
break;
}
o = i++;
p = s + 1;
}
else if (*s == '}')
s++;
else if (!isdigit(*s))
break;
else
{
if (i >= n)
{
break;
}
{
if (i >= (n - 2))
{
break;
}
ap[i++] = 0;
}
}
} while (p > s);
if (o)
ap[o] = i - o;
if (s[0] == 'E' || s[0] == 'e')
else if ((s[0] == 'I' || s[0] == 'i') && (s[1] == 'G' || s[1] == 'g'))
else
return 1;
}
return 0;
}
/*
* ipma writef
*/
static int
{
register int i;
register int j;
register int k;
{
}
{
for (i = 0; i < j; i++)
{
if (k = ap[++i])
{
k += i - 1;
while (i < k)
}
else
}
else
}
{
case BGP_ORIGIN_egp:
break;
case BGP_ORIGIN_igp:
break;
default:
break;
}
{
return -1;
}
return 0;
}
/*
* ipma closef
*/
static int
{
return -1;
return 0;
}
{
"ipma",
"ipma router dump format (2009-03-15) [http://www.merit.edu/~ipma/routing_table]",
CXH,
0,
0,
0,
};