2 USING: kernel alien alien.c-types
10 : set-if-addr ( name addr -- )
11 "struct-ifreq" <c-object>
12 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
13 swap 0 <inet4> make-sockaddr over set-struct-ifreq-ifr-ifru
15 AF_INET SOCK_DGRAM 0 socket SIOCSIFADDR rot ioctl drop ;
17 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
19 : set-if-flags ( name flags -- )
20 "struct-ifreq" <c-object>
21 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
22 swap <short> over set-struct-ifreq-ifr-ifru
24 AF_INET SOCK_DGRAM 0 socket SIOCSIFFLAGS rot ioctl drop ;
26 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
28 : set-if-dst-addr ( name addr -- )
29 "struct-ifreq" <c-object>
30 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
31 swap 0 <inet4> make-sockaddr over set-struct-ifreq-ifr-ifru
33 AF_INET SOCK_DGRAM 0 socket SIOCSIFDSTADDR rot ioctl drop ;
35 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
37 : set-if-brd-addr ( name addr -- )
38 "struct-ifreq" <c-object>
39 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
40 swap 0 <inet4> make-sockaddr over set-struct-ifreq-ifr-ifru
42 AF_INET SOCK_DGRAM 0 socket SIOCSIFBRDADDR rot ioctl drop ;
44 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
46 : set-if-netmask ( name addr -- )
47 "struct-ifreq" <c-object>
48 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
49 swap 0 <inet4> make-sockaddr over set-struct-ifreq-ifr-ifru
51 AF_INET SOCK_DGRAM 0 socket SIOCSIFNETMASK rot ioctl drop ;
53 ! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
55 : set-if-metric ( name metric -- )
56 "struct-ifreq" <c-object>
57 rot ascii string>alien over set-struct-ifreq-ifr-ifrn
58 swap <int> over set-struct-ifreq-ifr-ifru
60 AF_INET SOCK_DGRAM 0 socket SIOCSIFMETRIC rot ioctl drop ;