rawnet - add rawnet_status() call to check if interface is open.

This commit is contained in:
Kelvin Sherlock 2018-12-30 15:50:41 -05:00
parent 324c9a191f
commit c4796f77ec
7 changed files with 30 additions and 0 deletions

View File

@ -76,4 +76,11 @@ char *rawnet_get_standard_interface(void)
{ {
return rawnet_arch_get_standard_interface(); return rawnet_arch_get_standard_interface();
} }
extern int rawnet_status(void)
{
return rawnet_arch_status();
}
#endif /* #ifdef HAVE_RAWNET */ #endif /* #ifdef HAVE_RAWNET */

View File

@ -72,4 +72,6 @@ extern int rawnet_enumadapter(char **ppname, char **ppdescription);
extern int rawnet_enumadapter_close(void); extern int rawnet_enumadapter_close(void);
extern char *rawnet_get_standard_interface(void); extern char *rawnet_get_standard_interface(void);
extern int rawnet_status(void);
#endif #endif

View File

@ -69,4 +69,6 @@ extern char *rawnet_arch_get_standard_interface(void);
extern int rawnet_arch_get_mtu(void); extern int rawnet_arch_get_mtu(void);
extern int rawnet_arch_get_mac(uint8_t mac[6]); extern int rawnet_arch_get_mac(uint8_t mac[6]);
extern int rawnet_arch_status(void);
#endif #endif

View File

@ -498,3 +498,8 @@ int rawnet_arch_get_mac(uint8_t mac[6]) {
return -1; return -1;
} }
int rawnet_arch_status(void) {
return interface ? 1 : 0;
}

View File

@ -307,3 +307,7 @@ int rawnet_arch_get_mac(uint8_t mac[6]) {
} }
int rawnet_arch_status(void) {
return interface_fd >= 0 ? 1 : 0;
}

View File

@ -543,4 +543,9 @@ extern int rawnet_arch_get_mac(uint8_t mac[6]) {
return -1; return -1;
} }
int rawnet_arch_status(void) {
return rawnet_pcap_fp ? 1 : 0;
}
#endif /* #ifdef HAVE_RAWNET */ #endif /* #ifdef HAVE_RAWNET */

View File

@ -562,4 +562,9 @@ extern int rawnet_arch_get_mac(uint8_t mac[6]) {
return -1; return -1;
} }
int rawnet_arch_status(void) {
return EthernetPcapFP ? 1 : 0;
}
#endif /* #ifdef HAVE_RAWNET */ #endif /* #ifdef HAVE_RAWNET */