oms_aa_dest_addr_from_range_get()
Abstract
Obtains a random destination address within a given subset of addresses.
Syntax
oms_aa_dest_addr_from_range_get (oms_aa_handle, dest_address_ptr, low, high)
| Argument | Type | Description |
|---|---|---|
oms_aa_handle |
OmsT_Aa_Address_Handle |
Handle to the list for the specific address type |
dest_address_ptr |
int * |
Memory address to which the address will be copied |
low |
int |
Lowest array index in range of acceptable addresses |
high |
int |
Highest array index in range of acceptable addresses |
Return Type
void
No value returned
Details
This procedure obtains an address (whose destination status is OmsC_Aa_Valid_Destination) from a subset of addresses in an address list, as indicated by the low and high array indices.
Example
From tr_mac_interface process model, appl_layer_arrvl enter execs:
/* Determine the destination. Don't try infinite times. */
num_tries = 0;
do
{
/* Increment the try counter. This will prevent an infinite loop. */
num_tries++;
/* Pick a random destination address unless the destination address */
/* is already set to a specific value. */
if (low_dest_index + high_dest_index > 0)
oms_aa_dest_addr_from_range_get (oms_aa_handle, &dest_addr,
low_dest_index, high_dest_index);
else
dest_addr = destination_address;
oms_aa_dest_addr_get (oms_aa_handle, &dest_addr);
}
} while ((dest_addr == station_addr) && (num_tries < TRY_THRESH));
if (dest_addr == station_addr)
tr_gen_error ("Unable to choose remote address.", OPC_NIL, OPC_NIL);