:: Re: [DNG] libnetaid-0.1
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: aitor
Ημερομηνία:  
Προς: dng
Αντικείμενο: Re: [DNG] libnetaid-0.1
Hi,

On 2/3/20 1:03, aitor wrote:
>
> Hi again,
>
> On 1/3/20 22:36, aitor wrote:
>>
>> Hi all,
>>
>> The shared library of simple-netaid is ready for use.
>> Here you are the packages for devuan beowulf in amd64:
>>
>> http://gnuinos.org/libnetaid/
>>
>> Install all the packages and  write the following simple program:
>>
>> _______________________________
>>
>> #include <backend.h>
>>
>> int main (int argc, char **argv)
>> {
>>     print_active_wifis(argv[1]);
>>     return 0;
>> }
>>
>> _______________________________
>>
>> You can build it linking the shared library and the headers with the
>> following flags:
>>
>> $ gcc main.c -o main -lnetaid
>> -I/usr/include/x86_64-linux-gnu/simple-netaid
>>
>> Maybe  first of all you will need to update the ld cache via:
>>
>> $ sudo ldconfig
>>
>> Now, if you run the binary:
>>
>> $ sudo ./main wlan0
>>
>> you will get all the available active wifis (replace wlan0 by your
>> <wireless_device>.
>>
>> The above program is a very simple example, but shortly i will
>> document the usage
>> of this library and some functions like, for example:
>>
>> bool is_plugged(const char *device);
>> void show_devices();
>> void interface_up(const char *device);
>> void interface_down(const char *device);
>> void ifup(const char *device);
>> void ifdown(const char *device);
>> void print_active_wifis(const char *device);
>> void wired_connection(const char *device);
>> void wireless_connection(const char *device, const char *essid, const
>> char *password);
>> void show_network_connection();
>> void disconnect(const char *device);
>>
>> etc...
>>
>> Cheers,
>>
>> Aitor.
>>
> I fixed a bug related with the wireless_connection and uploaded the
> new packages.
>
> You can test this function building the following code:
>
>
> ______________________________________________
>
> #include <backend.h>
>
> int main (int argc, char **argv)
> {
>     wireless_connection(argv[1], argv[2], argv[3]);
>     return 0;
> }
>
> _______________________________________________
>
>
> and running:
>
> $ sudo ./main wlan0 <essid> <password>
>
> It's working for me without failures.
>
> Cheers,
>
> Aitor.
>

I'm updating the packages. Some parts of the code need changes when
upgrading from jessie to beowulf, mostly the code of iproute.

http://gnuinos.org/libnetaid

Build the folling example (as I explained above):

http://gnuinos.org/libnetaid/main.c

and run the following commands:

$ ./main 0

$ sudo ./main 1

$ sudo ./main 2 ESSID PASSWORD

$ sudo ./main 3

The first one says if you are connected; the second one gives you all
the available active wifis;
the third one connects to the wireless devices, and the last one
disconnects the device.

Cheers,

Aitor.