dag_config_get_named_attribute_uuid(3)

NAME
dag_config_get_named_attribute_uuid. retrieves the value of the attribute whose name was specified.

SYNOPSIS
#include "dag_config.h "

const char*
dag_config_get_named_attribute_uuid(dag_card_ref_t card, char* name,int index);.

DESCRIPTION
dag_config_get_named_attribute_uuid retrieves the value of the attribute from the name of the attribute.This function is used when you use dagconfig -G "attribute_name" functionality.This functionality provides a very user-friendly way to read the required attributes of the card to the user without requiring to write code.

RETURN VALUE
returns kDagErrNone on success kDagErrInvalidCardRef if the card reference is invalid. kDagErrNoSuchAttribute if we cannot find the attribute. kDagErrStatusAttribute if we try to modify a status attribute.

EXAMPLES
The following program illustrates how the Configuration & Status API is used. For the sake of clarity the error-handling code has been omitted from this example.This is not an ideal use case for the function.This is just a demonstrative example. In the below situation the user is advised to use dag_config_set_boolean_attribute.The ideal use case for this function is actually to expose dagconfig -G "attributename" functionality to the user.(That example is not demonstrated here because it is outside the scope of the man page.) int main(int argc, const char* argv[]) {

   dag_card_ref_t card_ref = NULL;
   dag_component_t root_component = NULL;
   uint32_t count;
   uint32_t i;
   char *value;

   /* Get a reference to the card. */
   card_ref = dag_config_init("/dev/dag0");
   /* Get a reference to the root component. */
   root_component = dag_config_get_root_component(card_ref);
   /* Find out how many ports the card has. */
   count = dag_component_get_subcomponent_count_of_type(root_component,
   kComponentPort);

   for (i = 0; i < count; i++)
   {
          dag_component_t port = NULL;
          attr_uuid_t active_uuid = 0;
          uint8_t val = 0;
          /* Get a reference to the port. */
          port = dag_component_get_subcomponent(root_component,
            kComponentPort, i);
          /* Get a reference to the active attribute of the port. */
          value = dag_config_get_named_attribute_uuid(card,"fcl",i);
          if (value == on)
             printf("Port %u configured in FCL mode ");
   }
   /* Dispose of the card. */
   dag_config_dispose(card_ref);
   return EXIT_SUCCESS; }

SEE ALSO
dag_config_set_named_attribute_uuid(3)

BUGS
Report bugs to <support@endace.com>.

LAST UPDATED
$Author: nuwan.gunasekara $
$Revision: 13756 $
$Date: 2011-01-17 11:22:36 +1300 (Mon, 17 Jan 2011) $

COPYRIGHT
(c) 2009 Endace Technology Ltd, Hamilton, New Zealand. All Rights Reserved.