Girish Moodalbail writes:
> On 04/02/09 09:37, Sowmini.Varadhan at Sun.COM wrote:
> > so a full-fledged solution for extracting "POSSIBLE" for a general property
> > should be able to handle an enumerated return value, right?
> 
> 
> Well then I will have a 'void **';
> 
> -------------
> typedef struct mac_propval_limit {
>      uint32_t range_min;
>      uint32_t range_max;
> } mac_propval_limit_t;
> 
> typedef struct mac_propval_range {
>      uint32_t range_num;
>      void **range_lim;
> } mac_propval_range_t;
> ------------
> 
> for MTU and CPU values you could typecast it to "mac_propval_limit_t".

I happen to like type checking, so I'd suggest using a union of types
instead of a 'void **'.  Perhaps something like:

typedef struct mac_propval_int_range_s {
        uint32_t range_min;
        uint32_t range_max;
} mac_propval_int_range_t;

typedef enum mac_propval_rtype_e {
        pvlInteger
} mac_propval_rtype_t;

typedef struct mac_propval_range_s {
        uint_t range_num;
        mac_propval_rtype_t range_type;
        union {
                mac_propval_int_range_t **pvl_ir;
        } u;
} mac_propval_range_t;

#define range_int       u.pvl_ir

... but it's probably not a big issue.

-- 
James Carlson, Solaris Networking              <james.d.carlson at sun.com>
Sun Microsystems / 35 Network Drive        71.232W   Vox +1 781 442 2084
MS UBUR02-212 / Burlington MA 01803-2757   42.496N   Fax +1 781 442 1677

Reply via email to