Re: [fpc-pascal] TUN/TAP

2009-10-07 Thread Jorge Aldo G. de F. Junior
thats h2pas result of compilling this structure into pascal. But thanks for the tip. 2009/10/7 Jürgen Hestermann > > > > Jorge Aldo G. de F. Junior schrieb: > >> type ifreq = record >> ifr_ifrn : record >> case longint of >> 0 : ( ifrn_name : array[0..15] of

Re: [fpc-pascal] TUN/TAP

2009-10-06 Thread Jürgen Hestermann
> Jorge Aldo G. de F. Junior schrieb: type ifreq = record ifr_ifrn : record case longint of 0 : ( ifrn_name : array[0..15] of char ); end; ifr_ifru : record case longint of 0 : ( ifru_addr : sockaddr

Re: [fpc-pascal] TUN/TAP

2009-10-06 Thread Jorge Aldo G. de F. Junior
ifreq becomes Const TUNSETIFF = $400454ca IFF_TUN = $0001 IFF_TAP = $0002 type ifreq = record ifr_ifrn : record case longint of 0 : ( ifrn_name : array[0..15] of char ); end; ifr_ifru : record case longint of

Re: [fpc-pascal] TUN/TAP

2009-10-05 Thread Henry Vermaak
2009/10/3 Jorge Aldo G. de F. Junior : > Can anyone help me decypher the following code : > > int tun_alloc(char *dev) > { > struct ifreq ifr; First, you need to get a pascal definition of struct ifreq, so look in /usr/include/linux/if.h and translate it to pascal (or try and use h2pas).

Re: [fpc-pascal] TUN/TAP

2009-10-04 Thread Jorge Aldo G. de F. Junior
i already knew about fpioctl, but the ioctl example uses some macros to get the correct code, but i dont understand how theres a python equivalent code that works, but i cant decypher this : (Python code) TUNSETIFF = 0x400454ca IFF_TUN = 0x0001 IFF_TAP = 0x0002 TUNMODE = IFF_TUN f = os.ope

Re: [fpc-pascal] TUN/TAP

2009-10-03 Thread Luca Olivetti
En/na Jorge Aldo G. de F. Junior ha escrit: Opening the TUN/TAP (/dev/net/tun) without the ioctl call is not doing the job, but i dont know how to do this with pascal equivalent code... There's an fpioctl function in freepascal (never used it though): http://www.freepascal.org/docs-html/rtl/b

[fpc-pascal] TUN/TAP

2009-10-02 Thread Jorge Aldo G. de F. Junior
Can anyone help me decypher the following code : int tun_alloc(char *dev) { struct ifreq ifr; int fd, err; if( (fd = open("/dev/net/tun", O_RDWR)) < 0 ) return tun_alloc_old(dev); memset(&ifr, 0, sizeof(ifr)); /* Flags: IFF_TUN - TUN device (no Etherne