Keywords: Intellon, Atheros, Qualcomm, HomePlug, powerline, communications, INT6000, INT6300, INT6400, AR7400, AR7420

Network Functions
Prev | Chapter 7. Support Function Reference | Next

## Network Functions

### NetworkBridges

`size_t NetworkBridges(` | channel, |
| memory, |
| extent`)`; |

`struct channel * channel`;
`void * memory`;
`size_t extent`;

Search a channel for local powerline devices (bridges) and store their Ethernet hardware in consecutive `memory` locations. The memory `extent` is specified in bytes. The number of devices found is returned as the function value, provided enough space is available to store all addressed. Unlike function NetworkDevices, the channel `peer` address is ignored.

We call local devices “bridges” because each serves as an Ethernet-to-Powerline bridge for the local host.

Example 7.1. Enumerating Local Devices

    #include <net/if.h>
    #include "../ether/channel.h"
    extern struct channel channel;
    uint8_t address [255][ETHER_ADDR_LEN];
    size_t bridges = NetworkBridges (&channel, address, sizeof (address));
    size_t bridge = 0;
    while (bridge < bridges)
    {
       binout (address [bridge], ETHER_ADDR_LEN, ':', stdout);
       putc ('\n', stdout);
    }

The code segment shown above illustrates how to use function `NetworkBridges` to identify all local devices. We do not need to set the channel `peer` because `NetworkBridges` always uses the Atheros `localcast` address. Array `address` is declared with two dimensions to simplify access to individual addresses on return.

### NetworkDevices

`size_t NetworkDevices(` | channel, |
| memory, |
| extent`)`; |

`struct channel * channel`;
`void * memory`;
`size_t extent`;

Query a powerline device, specified by channel, for neighboring network devices and store their Ethernet addresses in consecutive `memory` locations. The memory `extent` is specified in bytes. The number of devices found is returned as the function value, provided sufficient space is available to store all addresses. Unlike function NetworkBridges, the channel `peer` address is identifies the device to be queried.

Example 7.2. Enumerating Network Devices

    #include <net/if.h>
    #include "../ether/channel.h"
    extern struct channel channel;
    uint8_t address [255][ETHER_ADDR_LEN];
    size_t devices = NetworkDevices (&channel, address, sizeof (address));
    size_t device = 0;
    while (device < devices)
    {
       binout (address [device], ETHER_ADDR_LEN, ':', stdout);
       putc ('\n';, stdout);
    }

The code segment shown above illustrates how to use function `NetworkDevices` to identify all devices on a specific network. You must set the channel `peer` address before calling `NetworkDevices`. Array `address` is declared with two dimensions to simplify access to individual addresses on return. If the channel `peer` address is not the Ethernet `broadcast` or Atheros `localcast` address then the first address returned will be the channel `peer` address.

Prev | Up | Next
Ethernet Functions | Home | Generic Functions