/*
 *
 * 
 * 	(c) Copyright 1993 by Associated Universities, Inc. (AUI)
 * 
 *                       All Rights Reserved
 * 
 * Permission to use, copy, modify, and distribute this software and its 
 * documentation for any purpose and without fee is hereby granted, 
 * provided that the above copyright notice appear in all copies and that
 * both that copyright notice and this permission notice appear in 
 * supporting documentation, and that the name of AUI not be
 * used in advertising or publicity pertaining to distribution of the
 * software without specific, written prior permission.  
 * 
 * THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
 * AUI DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
 * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
 * AUI BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
 * ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
 * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
 * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
 * SOFTWARE.
 *
 *
 */
#include <stddef.h>

typedef struct {
  char *prefix,			/* prefix to match */
       *description,		/* interface description */
       *type,			/* interface type (6 = ethernet) */
       *speed,			/* speed in bits/sec (I think) */
       *ethernetDevice;		/* is it an ethernet device? */
} ANNOTATION ;

/* vxWorks interface annotations */
#include "vx_anno.h"

static const  int nAnnotations = sizeof(annotations)/sizeof(annotations[0]);

static const char* SNMP_DESCR = "snmp-descr" ;
static const char* SNMP_TYPE = "snmp-type" ;
static const char* SNMP_SPEED = "snmp-speed" ;
static const char* ENET_DEVICE = "ethernet-device" ;

/*
 * look up the text which describes some aspect of an interface 
 */

char *Lookup_Device_Annotation(char *device, char *lookup){

  int i = 0;

  /* check the prefixes for a match */
  for(i = 0; i < nAnnotations; i++)
    if(strncmp(device, annotations[i].prefix, strlen(annotations[i].prefix)) == 0){

      if(strncmp(lookup, SNMP_DESCR, strlen(SNMP_DESCR))==0){
	return annotations[i].description;
      }

      if(strncmp(lookup, SNMP_TYPE, strlen(SNMP_TYPE))==0){
	return annotations[i].type;
      }

      if(strncmp(lookup, SNMP_SPEED, strlen(SNMP_SPEED))==0){
	return annotations[i].speed;
      }

      if(strncmp(lookup, ENET_DEVICE, strlen(ENET_DEVICE))==0){
	return annotations[i].ethernetDevice;
      }

      /* unrecognized lookup */
      return(NULL);
    }

/* unrecognized device */
return NULL;
}
