This example shows how to open and close bRAWcap handles to each available adapter on the machine. If any unexpected status is returned, it will close all handles and print the unexpected status to console. Therefore brawcap_last_status is used.
34int main(
int argc,
char** argv)
37 SetConsoleTitleA(
"bRAWcap Example - Handle Opener");
53 memset(pHandleArray, 0, numberAdapters);
57 for(
int index = 0; index < numberAdapters; ++index)
68 printf(
"%02d. bRAWcap handle (%p) opened to %s.\n", index + 1, pHandleArray[index], name);
76 for(
int index = numberAdapters - 1; index >= 0; --index)
78 if (pHandleArray[index])
81 printf(
"%02d. bRAWcap handle (%p) closed.\n", index + 1, pHandleArray[index]);
struct _brawcap_handle brawcap_handle_t
A bRAWcap handle.
Definition: brawcap_types_um.h:173
brawcap_status_t brawcap_close(brawcap_handle_t *pHandle)
Closes the specified bRAWcap handle.
brawcap_status_t brawcap_open(const brawcap_adapter_name_t name, brawcap_handle_t **const pHandle)
Opens a new bRAWcap handle on the adapter, specified by it´s name.
brawcap_status_t brawcap_last_status()
Reads the last status appeared in bRAWcap, for the calling thread.
brawcap_status_t
bRAWcap status/return codes.
Definition: brawcap_types_shared.h:150
#define BRAWCAP_SUCCESS(status)
Checks if the returned status indicates a success with no additional info.
Definition: brawcap_types_shared.h:122
@ BRAWCAP_STATUS_SUCCESS
Definition: brawcap_types_shared.h:152
brawcap_status_t brawcap_adapter_list_at(const brawcap_adapter_count_t index, brawcap_adapter_name_t name)
Reads out the adapter name of the adapter at the adapter list index.
brawcap_status_t brawcap_adapter_list_count(brawcap_adapter_count_t *const pCount)
Reads out the current number of supported adapters in the adapter list.
char brawcap_adapter_name_t[BRAWCAP_ADAPTER_NAME_LENGTH]
Fixed size array containing a adapter name.
Definition: brawcap_types_um.h:257
UINT8 brawcap_adapter_count_t
Type used for counting the available/supported adapters on a machine.
Definition: brawcap_types_um.h:242