Rev 5143 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3545 | hidnplayr | 1 | eax = 74 - Work directly with network interface |
2 | ebx = -1 (Get number of active network devices) |
||
1737 | clevermous | 3 | |
3545 | hidnplayr | 4 | out: |
5 | eax = number of active network devices |
||
1737 | clevermous | 6 | |
3545 | hidnplayr | 7 | bh = device number, for all following functions ! |
1737 | clevermous | 8 | |
3545 | hidnplayr | 9 | bl = 0 (Get device type) |
1737 | clevermous | 10 | |
3545 | hidnplayr | 11 | out: |
12 | eax = device type number |
||
1737 | clevermous | 13 | |
3545 | hidnplayr | 14 | bl = 1 (Get device name) |
1737 | clevermous | 15 | |
3545 | hidnplayr | 16 | in: |
17 | ecx = pointer to 64 byte buffer |
||
18 | out: |
||
19 | name is copied into the buffer |
||
20 | eax = -1 on error |
||
1737 | clevermous | 21 | |
3545 | hidnplayr | 22 | bl = 2 (Reset the device) |
1737 | clevermous | 23 | |
3545 | hidnplayr | 24 | in |
25 | none |
||
26 | out |
||
27 | eax = -1 on error |
||
1737 | clevermous | 28 | |
3545 | hidnplayr | 29 | bl = 3 (Stop device) |
1737 | clevermous | 30 | |
3545 | hidnplayr | 31 | in |
32 | none |
||
33 | out |
||
34 | eax = -1 on error |
||
1737 | clevermous | 35 | |
3545 | hidnplayr | 36 | TO BE FIGURED OUT |
1737 | clevermous | 37 | |
3545 | hidnplayr | 38 | eax = 75 - Work with Sockets |
1737 | clevermous | 39 | |
3545 | hidnplayr | 40 | These functions work like the ones found in UNIX (and windows) |
41 | for more info, please read http://beej.us/guide/bgnet/ |
||
1737 | clevermous | 42 | |
3545 | hidnplayr | 43 | bl = 0 (Open Socket) |
1737 | clevermous | 44 | |
3545 | hidnplayr | 45 | in: |
46 | ecx = domain |
||
47 | edx = type |
||
48 | esi = protocol |
||
49 | out: |
||
50 | eax = socket number, -1 on error |
||
1737 | clevermous | 51 | |
3545 | hidnplayr | 52 | bl = 1 (Close Socket) |
1737 | clevermous | 53 | |
3545 | hidnplayr | 54 | in: |
55 | ecx = socket number |
||
56 | out: |
||
57 | eax = -1 on error |
||
1737 | clevermous | 58 | |
3545 | hidnplayr | 59 | bl = 2 (Bind) |
1737 | clevermous | 60 | |
3545 | hidnplayr | 61 | in: |
62 | ecx = socket number |
||
63 | edx = pointer to sockaddr structure |
||
64 | esi = length of sockaddr structure |
||
65 | out: |
||
66 | eax = -1 on error |
||
1737 | clevermous | 67 | |
3545 | hidnplayr | 68 | bl = 3 (Listen) |
1737 | clevermous | 69 | |
3545 | hidnplayr | 70 | in: |
71 | ecx = socket number |
||
72 | edx = backlog |
||
73 | out: |
||
74 | eax = -1 on error |
||
1737 | clevermous | 75 | |
3545 | hidnplayr | 76 | bl = 4 (connect) |
1737 | clevermous | 77 | |
3545 | hidnplayr | 78 | in: |
79 | ecx = socket number |
||
80 | edx = pointer to sockaddr structure |
||
81 | esi = length of sockaddr structure |
||
82 | out: |
||
83 | eax = -1 on error |
||
1737 | clevermous | 84 | |
3545 | hidnplayr | 85 | bl = 5 (accept) |
1737 | clevermous | 86 | |
3545 | hidnplayr | 87 | in: |
88 | ecx = socket number |
||
89 | edx = pointer to sockaddr structure |
||
90 | esi = length of sockaddr structure |
||
91 | out: |
||
92 | eax = socket number, -1 on error |
||
1737 | clevermous | 93 | |
3545 | hidnplayr | 94 | bl = 6 (send) |
1737 | clevermous | 95 | |
3545 | hidnplayr | 96 | in: |
97 | ecx = socket number |
||
98 | edx = pointer to buffer |
||
99 | esi = length of buffer |
||
100 | edi = flags |
||
101 | out: |
||
102 | eax = -1 on error |
||
1737 | clevermous | 103 | |
3545 | hidnplayr | 104 | bl = 7 (receive) |
1737 | clevermous | 105 | |
3545 | hidnplayr | 106 | in: |
107 | ecx = socket number |
||
108 | edx = pointer to buffer |
||
109 | esi = length of buffer |
||
110 | edi = flags |
||
111 | out: |
||
112 | eax = number of bytes copied, -1 on error |
||
1737 | clevermous | 113 | |
3545 | hidnplayr | 114 | bl = 8 (set socket options) |
1737 | clevermous | 115 | |
3545 | hidnplayr | 116 | in: |
117 | ecx = socket number |
||
5143 | hidnplayr | 118 | edx = ptr to optstruct |
1737 | clevermous | 119 | |
5143 | hidnplayr | 120 | Optstruct: dd level |
121 | dd optionname |
||
122 | dd optlength |
||
123 | db options... |
||
124 | |||
3545 | hidnplayr | 125 | The buffer's first dword is the length of the buffer, minus the first dword offcourse |
1737 | clevermous | 126 | |
3545 | hidnplayr | 127 | out: |
128 | eax = -1 on error |
||
1737 | clevermous | 129 | |
5143 | hidnplayr | 130 | bl = 9 (get socket options) |
1737 | clevermous | 131 | |
3545 | hidnplayr | 132 | in: |
133 | ecx = socket number |
||
5143 | hidnplayr | 134 | edx = ptr to optstruct |
1737 | clevermous | 135 | |
5143 | hidnplayr | 136 | Optstruct: dd level |
137 | dd optionname |
||
138 | dd optlength |
||
139 | db options... |
||
3545 | hidnplayr | 140 | out: |
141 | eax = -1 on error, socket option otherwise |
||
1737 | clevermous | 142 | |
5143 | hidnplayr | 143 | bl = 10 (get IPC socketpair) |
144 | |||
145 | in: |
||
146 | / |
||
147 | out: |
||
148 | eax = -1 on error, socketnum1 otherwise |
||
149 | ebx = socketnum2 |
||
150 | |||
3545 | hidnplayr | 151 | TIP |
1737 | clevermous | 152 | |
3545 | hidnplayr | 153 | when you import 'network.inc' and 'macros.inc' into your source code, you can use the following syntax to work with sockets: |
1737 | clevermous | 154 | |
155 | |||
3545 | hidnplayr | 156 | for example, to open a socket |
1737 | clevermous | 157 | |
3545 | hidnplayr | 158 | mcall socket, AF_INET, SOCK_DGRAM,0 |
159 | mov [socketnum], eax |
||
1737 | clevermous | 160 | |
3545 | hidnplayr | 161 | then to connect to a server |
1737 | clevermous | 162 | |
3545 | hidnplayr | 163 | mcall connect, [socketnum], sockaddr, 18 |
1737 | clevermous | 164 | |
165 | |||
3545 | hidnplayr | 166 | eax = 76 - Work with protocols |
1737 | clevermous | 167 | |
3545 | hidnplayr | 168 | high half of ebx = protocol number (for all subfunctions!) |
169 | bh = device number (for all subfunctions!) |
||
170 | bl = subfunction number, depends on protocol type |
||
1737 | clevermous | 171 | |
3545 | hidnplayr | 172 | For Ethernet protocol |
1737 | clevermous | 173 | |
3545 | hidnplayr | 174 | |
175 | 1 - Read # Packets received |
||
176 | 2 - Read # Bytes send |
||
177 | 3 - Read # Bytes received |
||
178 | 4 - Read MAC |
||
179 | 5 - Write MAC |
||
180 | 6 - Read IN-QUEUE size |
||
181 | 7 - Read OUT-QUEUE size |
||
182 | For IPv4 protocol |
||
1737 | clevermous | 183 | |
3545 | hidnplayr | 184 | |
185 | 1 - Read # IP packets received |
||
186 | 2 - Read IP |
||
187 | 3 - Write IP |
||
188 | 4 - Read DNS |
||
189 | 5 - Write DNS |
||
190 | 6 - Read subnet |
||
191 | 7 - Write subnet |
||
192 | 8 - Read gateway |
||
193 | 9 - Write gateway |
||
194 | For ARP protocol |
||
1737 | clevermous | 195 | |
3545 | hidnplayr | 196 | |
197 | 1 - Read # ARP packets received |
||
198 | 2 - Get # ARP entry's |
||
199 | 3 - Read ARP entry |
||
200 | 4 - Add static ARP entry |
||
201 | 5 - Remove ARP entry (-1 = remove all) |
||
202 | For ICMP protocol |
||
1737 | clevermous | 203 | |
3545 | hidnplayr | 204 | |
205 | 1 - Read # ICMP packets received |
||
206 | 3 - enable/disable ICMP echo reply |
||
207 | For UDP protocol |
||
1737 | clevermous | 208 | |
3545 | hidnplayr | 209 | |
210 | 1 - Read # UDP packets received |
||
211 | For TCP protocol |
||
1737 | clevermous | 212 | |
3545 | hidnplayr | 213 | |
214 | 1 - Read # TCP packets received |