static void show_releases(const char *hostname, const int verbose)
{
  GTH_api api;
  int result;
  char attribute[1000];

  result = gth_connect(&api, hostname, verbose);

  if (result != 0) {
    die("unable to connect to GTH");
  }

  result = gth_query_resource_attribute(&api, "system_image", "version", 
					attribute, sizeof(attribute));
  assert(result == 0);

  printf("  Current system image version: %s\n", attribute);

  result = gth_query_resource_attribute(&api, "failsafe_image", "version", 
					attribute, sizeof(attribute));
  assert(result == 0);

  printf("Current failsafe image version: %s\n", attribute);

  
  gth_bye(&api);
}
// Start L1 for all channels.
// This can cause an L1 to be started multiple times. That's OK.
static void
enable_l1(GTH_api *api,
	  const Channel_t channels[],
	  const int n_channels,
	  const int monitoring)
{
  char architecture[10];
  int i;
  int result;

  result = gth_query_resource_attribute(api, "board", "architecture",
					architecture, 10);
  if (result != 0)
    die("Unable to query hardware architecture. Giving up.");

  architecture[3] = 0;
  if (strcmp(architecture, "gth") == 0) {
    for (i = 0; i < n_channels; i++) {
      enable_electrical_l1(api, channels[i].span, monitoring);
    }
  }
  else {
    for (i = 0; i < n_channels; i++) {
      enable_optical_l1(api, channels[i].span, monitoring);
    }
  }
}
static void check_layer_1(GTH_api *api, const char *pcm_name) {
  char buffer[MAX_L1_STATUS];
  int result;

  result = gth_query_resource_attribute(api, pcm_name, "status",
					buffer, MAX_L1_STATUS);
  assert(result == 0);

  if (strcmp(buffer, "OK") && strcmp(buffer, "RAI")) {
    fprintf(stderr,
	    "Warning: L1 status of %s is '%s', data is most likely useless\n",
	    pcm_name, buffer);
  }
}
void
read_hw_description(GTH_api *api, const char *hostname)
{
  int result;
  char architecture[10];

  result = gth_query_resource_attribute(api, "board", "architecture",
					architecture, 10);
  if (result != 0)
    die("Unable to query hardware architecture. Giving up.");

  result = snprintf(hw_description, MAX_HW_DESCRIPTION,
		    "save_to_pcap (Corelatus %s %s)",
		    architecture, hostname);
  if (result >= MAX_HW_DESCRIPTION)
    die("Hardware description is too long");
}