Listing RAD Instances of an Interface in C

An interface can contain multiple RAD instances. For example, the zonemgr module defines a Zone interface and an instance of this interface exists for each zone on the system. A module provides a list function for each of its interfaces in the form, module_interface__rad_list().

Example 2-4 C Language – Listing RAD Interface Instances

#include<rad/radclient.h>
#include<rad/radclient_basetypes.h>
#include<rad/client/1/zonemgr.h>

rc_err_t status; 
adr_name_t **name_list;
int name_count;

rc_conn_t *conn = rc_connect_unix(NULL, NULL);
if (conn !=NULL) {
  status = zonemgr_Zone__rad_list(conn, B_TRUE, NS_GLOB, &name_list,
    &name_count, 0);
   if(status == RCE_OK) {
      for (int i =0; i < name_count; i++) {
      char*name =adr_name_tostr(name_list[i]);
        printf("%s\n", name);
      }
     name_array_free(name_list, name_count);
     } 
  }