oms_aa_dest_addr_from_range_get()
摘要
在给定的地址子集内获取一个随机的目的地址。
语法
oms_aa_dest_addr_from_range_get (oms_aa_handle, dest_address_ptr, low, high)
| 参数 | 类型 | 说明 |
|---|---|---|
oms_aa_handle |
OmsT_Aa_Address_Handle |
特定地址类型对应列表的句柄 |
dest_address_ptr |
int * |
用于保存所获取地址的内存地址 |
low |
int |
可接受地址范围中最小的数组索引 |
high |
int |
可接受地址范围中最大的数组索引 |
返回类型
void
无返回值
详细说明
该过程从地址列表中由 low 和 high 数组索引所指示的地址子集里,获取一个目的状态为 OmsC_Aa_Valid_Destination 的地址。
示例
来自 tr_mac_interface 进程模型中 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);