Example #1
0
/* Check our protocol family table for this family and return its socket */
int get_socket_for_af(int af)
{
    struct aftype **afp;

    if (!sVafinit)
	afinit();

    afp = aftypes;
    while (*afp != NULL) {
	if ((*afp)->af == af)
	    return (*afp)->fd;
	afp++;
    }
    return -1;
}
Example #2
0
/* Check our protocol family table for this family. */
struct aftype *get_afntype(int af)
{
    struct aftype **afp;

    if (!sVafinit)
	afinit();

    afp = aftypes;
    while (*afp != NULL) {
	if ((*afp)->af == af)
	    return (*afp);
	afp++;
    }
    return (NULL);
}
Example #3
0
/* Check our protocol family table for this family. */
struct aftype *get_aftype(const char *name)
{
    struct aftype **afp;

    if (!sVafinit)
	afinit();

    afp = aftypes;
    while (*afp != NULL) {
	if (!strcmp((*afp)->name, name))
	    return (*afp);
	afp++;
    }
    if (index(name, ','))
	fprintf(stderr, _("Please don't supply more than one address family.\n"));
    return (NULL);
}
Example #4
0
/* type: 0=all, 1=getroute */
void print_aflist(int type) {
    int count = 0;
    const char * txt;
    struct aftype * const *afp;

    if (!sVafinit)
	afinit();

    afp = aftypes;
    while (*afp != NULL) {
	if ((type == 1 && ((*afp)->rprint == NULL)) || ((*afp)->af == 0)) {
		afp++; continue;
	}
	if ((count % 3) == 0) fprintf(stderr,count?"\n    ":"    ");
        txt = (*afp)->name; if (!txt) txt = "..";
	fprintf(stderr,"%s (%s) ",txt,(*afp)->title);
	count++;
	afp++;
    }
    fprintf(stderr,"\n");
}