Esempio n. 1
0
int rawnet_arch_init(void)
{
    rawnet_arch_log = log_open("TFEARCH");

    if (!TfePcapLoadLibrary()) {
        return 0;
    }

    return 1;
}
Esempio n. 2
0
int tfe_arch_init(void)
{
//   g_fh = log_open("TFEARCH");

    if (!TfePcapLoadLibrary()) {
        return 0;
    }

    return 1;
}
Esempio n. 3
0
/*
 These functions let the UI enumerate the available interfaces.

 First, TfeEnumAdapterOpen() is used to start enumeration.

 TfeEnumAdapter is then used to gather information for each adapter present
 on the system, where:

   ppname points to a pointer which will hold the name of the interface
   ppdescription points to a pointer which will hold the description of the interface

   For each of these parameters, new memory is allocated, so it has to be
   freed with lib_free().

 TfeEnumAdapterClose() must be used to stop processing.

 Each function returns 1 on success, and 0 on failure.
 TfeEnumAdapter() only fails if there is no more adpater; in this case, 
   *ppname and *ppdescription are not altered.
*/
int rawnet_arch_enumadapter_open(void)
{
    if (!TfePcapLoadLibrary()) {
        return 0;
    }

    if ((*p_pcap_findalldevs)(&TfePcapAlldevs, TfePcapErrbuf) == -1) {
        log_message(rawnet_arch_log, "ERROR in TfeEnumAdapterOpen: pcap_findalldevs: '%s'", TfePcapErrbuf);
        return 0;
    }

    if (!TfePcapAlldevs) {
        log_message(rawnet_arch_log, "ERROR in TfeEnumAdapterOpen, finding all pcap devices - Do we have the necessary privilege rights?");
        return 0;
    }

    TfePcapNextDev = TfePcapAlldevs;

    return 1;
}