bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 1 | #ifndef __COMMON_H__ |
| 2 | #define __COMMON_H__ |
| 3 | |
bellard | 5fa0ab8 | 2007-11-07 19:27:18 +0000 | [diff] [blame] | 4 | #include "config-host.h" |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 5 | #include "slirp_config.h" |
| 6 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 7 | #ifdef _WIN32 |
| 8 | # include <inttypes.h> |
| 9 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 10 | typedef char *caddr_t; |
| 11 | |
bellard | 3444413 | 2005-01-10 23:19:34 +0000 | [diff] [blame] | 12 | # include <windows.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 13 | # include <winsock2.h> |
balrog | 116842e | 2008-05-17 18:07:00 +0000 | [diff] [blame] | 14 | # include <ws2tcpip.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 15 | # include <sys/timeb.h> |
| 16 | # include <iphlpapi.h> |
| 17 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 18 | #else |
| 19 | # define ioctlsocket ioctl |
| 20 | # define closesocket(s) close(s) |
Andreas Färber | 4a2b39d | 2010-09-20 00:50:48 +0200 | [diff] [blame] | 21 | # if !defined(__HAIKU__) |
| 22 | # define O_BINARY 0 |
| 23 | # endif |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 24 | #endif |
| 25 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 26 | #include <sys/types.h> |
| 27 | #ifdef HAVE_SYS_BITYPES_H |
| 28 | # include <sys/bitypes.h> |
| 29 | #endif |
| 30 | |
bellard | 170c6f8 | 2004-06-03 12:53:17 +0000 | [diff] [blame] | 31 | #include <sys/time.h> |
| 32 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 33 | #ifdef HAVE_UNISTD_H |
| 34 | # include <unistd.h> |
| 35 | #endif |
| 36 | |
| 37 | #ifdef HAVE_STDLIB_H |
| 38 | # include <stdlib.h> |
| 39 | #endif |
| 40 | |
| 41 | #include <stdio.h> |
| 42 | #include <errno.h> |
| 43 | |
| 44 | #ifndef HAVE_MEMMOVE |
| 45 | #define memmove(x, y, z) bcopy(y, x, z) |
| 46 | #endif |
| 47 | |
| 48 | #if TIME_WITH_SYS_TIME |
| 49 | # include <sys/time.h> |
| 50 | # include <time.h> |
| 51 | #else |
blueswir1 | eb38c52 | 2008-09-06 17:47:39 +0000 | [diff] [blame] | 52 | # ifdef HAVE_SYS_TIME_H |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 53 | # include <sys/time.h> |
| 54 | # else |
| 55 | # include <time.h> |
| 56 | # endif |
| 57 | #endif |
| 58 | |
| 59 | #ifdef HAVE_STRING_H |
| 60 | # include <string.h> |
| 61 | #else |
| 62 | # include <strings.h> |
| 63 | #endif |
| 64 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 65 | #ifndef _WIN32 |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 66 | #include <sys/uio.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 67 | #endif |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 68 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 69 | #ifndef _WIN32 |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 70 | #include <netinet/in.h> |
| 71 | #include <arpa/inet.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 72 | #endif |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 73 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 74 | /* Systems lacking strdup() definition in <string.h>. */ |
| 75 | #if defined(ultrix) |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 76 | char *strdup(const char *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 77 | #endif |
| 78 | |
| 79 | /* Systems lacking malloc() definition in <stdlib.h>. */ |
| 80 | #if defined(ultrix) || defined(hcx) |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 81 | void *malloc(size_t arg); |
| 82 | void free(void *ptr); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 83 | #endif |
| 84 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 85 | #include <fcntl.h> |
| 86 | #ifndef NO_UNIX_SOCKETS |
| 87 | #include <sys/un.h> |
| 88 | #endif |
| 89 | #include <signal.h> |
| 90 | #ifdef HAVE_SYS_SIGNAL_H |
| 91 | # include <sys/signal.h> |
| 92 | #endif |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 93 | #ifndef _WIN32 |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 94 | #include <sys/socket.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 95 | #endif |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 96 | |
bellard | ee2654a | 2004-07-12 21:11:45 +0000 | [diff] [blame] | 97 | #if defined(HAVE_SYS_IOCTL_H) |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 98 | # include <sys/ioctl.h> |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 99 | #endif |
| 100 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 101 | #ifdef HAVE_SYS_SELECT_H |
| 102 | # include <sys/select.h> |
| 103 | #endif |
| 104 | |
| 105 | #ifdef HAVE_SYS_WAIT_H |
| 106 | # include <sys/wait.h> |
| 107 | #endif |
| 108 | |
| 109 | #ifdef HAVE_SYS_FILIO_H |
| 110 | # include <sys/filio.h> |
| 111 | #endif |
| 112 | |
| 113 | #ifdef USE_PPP |
| 114 | #include <ppp/slirppp.h> |
| 115 | #endif |
| 116 | |
| 117 | #ifdef __STDC__ |
| 118 | #include <stdarg.h> |
| 119 | #else |
| 120 | #include <varargs.h> |
| 121 | #endif |
| 122 | |
| 123 | #include <sys/stat.h> |
| 124 | |
| 125 | /* Avoid conflicting with the libc insque() and remque(), which |
| 126 | have different prototypes. */ |
| 127 | #define insque slirp_insque |
| 128 | #define remque slirp_remque |
| 129 | |
| 130 | #ifdef HAVE_SYS_STROPTS_H |
| 131 | #include <sys/stropts.h> |
| 132 | #endif |
| 133 | |
| 134 | #include "debug.h" |
| 135 | |
Paolo Bonzini | 1de7afc | 2012-12-17 18:20:00 +0100 | [diff] [blame] | 136 | #include "qemu/queue.h" |
| 137 | #include "qemu/sockets.h" |
Jan Kiszka | b1c99fc | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 138 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 139 | #include "libslirp.h" |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 140 | #include "ip.h" |
| 141 | #include "tcp.h" |
| 142 | #include "tcp_timer.h" |
| 143 | #include "tcp_var.h" |
| 144 | #include "tcpip.h" |
| 145 | #include "udp.h" |
Jan Kiszka | e6d43cf | 2011-07-20 12:20:18 +0200 | [diff] [blame] | 146 | #include "ip_icmp.h" |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 147 | #include "mbuf.h" |
| 148 | #include "sbuf.h" |
| 149 | #include "socket.h" |
| 150 | #include "if.h" |
| 151 | #include "main.h" |
| 152 | #include "misc.h" |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 153 | #ifdef USE_PPP |
| 154 | #include "ppp/pppd.h" |
| 155 | #include "ppp/ppp.h" |
| 156 | #endif |
| 157 | |
| 158 | #include "bootp.h" |
bellard | c7f7464 | 2004-08-24 21:57:12 +0000 | [diff] [blame] | 159 | #include "tftp.h" |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 160 | |
Fabien Chouteau | 1a0ca1e | 2011-08-03 12:52:54 +0200 | [diff] [blame] | 161 | #define ETH_ALEN 6 |
| 162 | #define ETH_HLEN 14 |
| 163 | |
| 164 | #define ETH_P_IP 0x0800 /* Internet Protocol packet */ |
| 165 | #define ETH_P_ARP 0x0806 /* Address Resolution packet */ |
| 166 | |
| 167 | #define ARPOP_REQUEST 1 /* ARP request */ |
| 168 | #define ARPOP_REPLY 2 /* ARP reply */ |
| 169 | |
| 170 | struct ethhdr { |
| 171 | unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ |
| 172 | unsigned char h_source[ETH_ALEN]; /* source ether addr */ |
| 173 | unsigned short h_proto; /* packet type ID field */ |
| 174 | }; |
| 175 | |
| 176 | struct arphdr { |
| 177 | unsigned short ar_hrd; /* format of hardware address */ |
| 178 | unsigned short ar_pro; /* format of protocol address */ |
| 179 | unsigned char ar_hln; /* length of hardware address */ |
| 180 | unsigned char ar_pln; /* length of protocol address */ |
| 181 | unsigned short ar_op; /* ARP opcode (command) */ |
| 182 | |
| 183 | /* |
| 184 | * Ethernet looks like this : This bit is variable sized however... |
| 185 | */ |
| 186 | unsigned char ar_sha[ETH_ALEN]; /* sender hardware address */ |
| 187 | uint32_t ar_sip; /* sender IP address */ |
| 188 | unsigned char ar_tha[ETH_ALEN]; /* target hardware address */ |
| 189 | uint32_t ar_tip; /* target IP address */ |
Stefan Weil | 541dc0d | 2011-08-31 12:38:01 +0200 | [diff] [blame] | 190 | } QEMU_PACKED; |
Fabien Chouteau | 1a0ca1e | 2011-08-03 12:52:54 +0200 | [diff] [blame] | 191 | |
| 192 | #define ARP_TABLE_SIZE 16 |
| 193 | |
| 194 | typedef struct ArpTable { |
| 195 | struct arphdr table[ARP_TABLE_SIZE]; |
| 196 | int next_victim; |
| 197 | } ArpTable; |
| 198 | |
Jan Kiszka | 5a371a2 | 2011-08-05 12:51:11 +0200 | [diff] [blame] | 199 | void arp_table_add(Slirp *slirp, uint32_t ip_addr, uint8_t ethaddr[ETH_ALEN]); |
Fabien Chouteau | 1a0ca1e | 2011-08-03 12:52:54 +0200 | [diff] [blame] | 200 | |
Jan Kiszka | 5a371a2 | 2011-08-05 12:51:11 +0200 | [diff] [blame] | 201 | bool arp_table_search(Slirp *slirp, uint32_t ip_addr, |
Fabien Chouteau | 1a0ca1e | 2011-08-03 12:52:54 +0200 | [diff] [blame] | 202 | uint8_t out_ethaddr[ETH_ALEN]); |
Kevin Wolf | 40ff6d7 | 2009-12-02 12:24:42 +0100 | [diff] [blame] | 203 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 204 | struct Slirp { |
Blue Swirl | 72cf2d4 | 2009-09-12 07:36:22 +0000 | [diff] [blame] | 205 | QTAILQ_ENTRY(Slirp) entry; |
Liu Ping Fan | fe0ff43 | 2013-08-25 10:01:19 +0800 | [diff] [blame] | 206 | u_int time_fasttimo; |
| 207 | u_int last_slowtimo; |
| 208 | bool do_slowtimo; |
Jan Kiszka | b1c99fc | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 209 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 210 | /* virtual network configuration */ |
| 211 | struct in_addr vnetwork_addr; |
| 212 | struct in_addr vnetwork_mask; |
| 213 | struct in_addr vhost_addr; |
| 214 | struct in_addr vdhcp_startaddr; |
| 215 | struct in_addr vnameserver_addr; |
| 216 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 217 | struct in_addr client_ipaddr; |
| 218 | char client_hostname[33]; |
| 219 | |
| 220 | int restricted; |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 221 | struct ex_list *exec_list; |
| 222 | |
| 223 | /* mbuf states */ |
| 224 | struct mbuf m_freelist, m_usedlist; |
| 225 | int mbuf_alloced; |
| 226 | |
| 227 | /* if states */ |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 228 | struct mbuf if_fastq; /* fast queue (for interactive data) */ |
| 229 | struct mbuf if_batchq; /* queue for non-interactive data */ |
| 230 | struct mbuf *next_m; /* pointer to next mbuf to output */ |
Jan Kiszka | 953e7f5 | 2012-03-05 19:50:39 +0100 | [diff] [blame] | 231 | bool if_start_busy; /* avoid if_start recursion */ |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 232 | |
| 233 | /* ip states */ |
| 234 | struct ipq ipq; /* ip reass. queue */ |
Stefan Weil | b6dce92 | 2010-07-22 22:15:23 +0200 | [diff] [blame] | 235 | uint16_t ip_id; /* ip packet ctr, for ids */ |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 236 | |
| 237 | /* bootp/dhcp states */ |
| 238 | BOOTPClient bootp_clients[NB_BOOTP_CLIENTS]; |
| 239 | char *bootp_filename; |
Klaus Stengel | 63d2960 | 2012-10-27 19:53:39 +0200 | [diff] [blame] | 240 | size_t vdnssearch_len; |
| 241 | uint8_t *vdnssearch; |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 242 | |
| 243 | /* tcp states */ |
| 244 | struct socket tcb; |
| 245 | struct socket *tcp_last_so; |
| 246 | tcp_seq tcp_iss; /* tcp initial send seq # */ |
Stefan Weil | b6dce92 | 2010-07-22 22:15:23 +0200 | [diff] [blame] | 247 | uint32_t tcp_now; /* for RFC 1323 timestamps */ |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 248 | |
| 249 | /* udp states */ |
| 250 | struct socket udb; |
| 251 | struct socket *udp_last_so; |
| 252 | |
Jan Kiszka | e6d43cf | 2011-07-20 12:20:18 +0200 | [diff] [blame] | 253 | /* icmp states */ |
| 254 | struct socket icmp; |
| 255 | struct socket *icmp_last_so; |
| 256 | |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 257 | /* tftp states */ |
| 258 | char *tftp_prefix; |
| 259 | struct tftp_session tftp_sessions[TFTP_SESSIONS_MAX]; |
| 260 | |
Fabien Chouteau | 1a0ca1e | 2011-08-03 12:52:54 +0200 | [diff] [blame] | 261 | ArpTable arp_table; |
| 262 | |
Jan Kiszka | 9f8bd04 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 263 | void *opaque; |
Jan Kiszka | 460fec6 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 264 | }; |
| 265 | |
Jan Kiszka | ad0d8c4 | 2009-06-24 14:42:31 +0200 | [diff] [blame] | 266 | extern Slirp *slirp_instance; |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 267 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 268 | #ifndef NULL |
| 269 | #define NULL (void *)0 |
| 270 | #endif |
| 271 | |
| 272 | #ifndef FULL_BOLT |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 273 | void if_start(Slirp *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 274 | #else |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 275 | void if_start(struct ttys *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 276 | #endif |
| 277 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 278 | #ifndef HAVE_STRERROR |
Blue Swirl | 64b85a8 | 2011-01-23 16:21:20 +0000 | [diff] [blame] | 279 | char *strerror(int error); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 280 | #endif |
| 281 | |
| 282 | #ifndef HAVE_INDEX |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 283 | char *index(const char *, int); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 284 | #endif |
| 285 | |
| 286 | #ifndef HAVE_GETHOSTID |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 287 | long gethostid(void); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 288 | #endif |
| 289 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 290 | #ifndef _WIN32 |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 291 | #include <netdb.h> |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 292 | #endif |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 293 | |
| 294 | #define DEFAULT_BAUD 115200 |
| 295 | |
blueswir1 | 9634d90 | 2007-10-26 19:01:16 +0000 | [diff] [blame] | 296 | #define SO_OPTIONS DO_KEEPALIVE |
| 297 | #define TCP_MAXIDLE (TCPTV_KEEPCNT * TCPTV_KEEPINTVL) |
| 298 | |
Klaus Stengel | 63d2960 | 2012-10-27 19:53:39 +0200 | [diff] [blame] | 299 | /* dnssearch.c */ |
| 300 | int translate_dnssearch(Slirp *s, const char ** names); |
| 301 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 302 | /* cksum.c */ |
| 303 | int cksum(struct mbuf *m, int len); |
| 304 | |
| 305 | /* if.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 306 | void if_init(Slirp *); |
| 307 | void if_output(struct socket *, struct mbuf *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 308 | |
| 309 | /* ip_input.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 310 | void ip_init(Slirp *); |
Jan Kiszka | a68adc2 | 2012-02-29 19:14:23 +0100 | [diff] [blame] | 311 | void ip_cleanup(Slirp *); |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 312 | void ip_input(struct mbuf *); |
| 313 | void ip_slowtimo(Slirp *); |
| 314 | void ip_stripoptions(register struct mbuf *, struct mbuf *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 315 | |
| 316 | /* ip_output.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 317 | int ip_output(struct socket *, struct mbuf *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 318 | |
| 319 | /* tcp_input.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 320 | void tcp_input(register struct mbuf *, int, struct socket *); |
| 321 | int tcp_mss(register struct tcpcb *, u_int); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 322 | |
| 323 | /* tcp_output.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 324 | int tcp_output(register struct tcpcb *); |
| 325 | void tcp_setpersist(register struct tcpcb *); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 326 | |
| 327 | /* tcp_subr.c */ |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 328 | void tcp_init(Slirp *); |
Jan Kiszka | a68adc2 | 2012-02-29 19:14:23 +0100 | [diff] [blame] | 329 | void tcp_cleanup(Slirp *); |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 330 | void tcp_template(struct tcpcb *); |
| 331 | void tcp_respond(struct tcpcb *, register struct tcpiphdr *, register struct mbuf *, tcp_seq, tcp_seq, int); |
| 332 | struct tcpcb * tcp_newtcpcb(struct socket *); |
| 333 | struct tcpcb * tcp_close(register struct tcpcb *); |
| 334 | void tcp_sockclosed(struct tcpcb *); |
| 335 | int tcp_fconnect(struct socket *); |
| 336 | void tcp_connect(struct socket *); |
| 337 | int tcp_attach(struct socket *); |
Stefan Weil | b6dce92 | 2010-07-22 22:15:23 +0200 | [diff] [blame] | 338 | uint8_t tcp_tos(struct socket *); |
Blue Swirl | 6cb9c6d | 2009-07-01 19:11:17 +0000 | [diff] [blame] | 339 | int tcp_emu(struct socket *, struct mbuf *); |
| 340 | int tcp_ctl(struct socket *); |
bellard | 9fafc9e | 2004-04-26 19:50:09 +0000 | [diff] [blame] | 341 | struct tcpcb *tcp_drop(struct tcpcb *tp, int err); |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 342 | |
| 343 | #ifdef USE_PPP |
| 344 | #define MIN_MRU MINMRU |
| 345 | #define MAX_MRU MAXMRU |
| 346 | #else |
| 347 | #define MIN_MRU 128 |
| 348 | #define MAX_MRU 16384 |
| 349 | #endif |
| 350 | |
bellard | 379ff53 | 2004-07-12 22:33:07 +0000 | [diff] [blame] | 351 | #ifndef _WIN32 |
| 352 | #define min(x,y) ((x) < (y) ? (x) : (y)) |
| 353 | #define max(x,y) ((x) > (y) ? (x) : (y)) |
| 354 | #endif |
| 355 | |
bellard | 02d2c54 | 2004-10-07 23:27:35 +0000 | [diff] [blame] | 356 | #ifdef _WIN32 |
bellard | ef6ff6b | 2004-11-14 18:58:04 +0000 | [diff] [blame] | 357 | #undef errno |
bellard | 02d2c54 | 2004-10-07 23:27:35 +0000 | [diff] [blame] | 358 | #define errno (WSAGetLastError()) |
| 359 | #endif |
| 360 | |
bellard | f0cbd3e | 2004-04-22 00:10:48 +0000 | [diff] [blame] | 361 | #endif |