~ubuntu-branches/ubuntu/trusty/virtualbox-ose/trusty

« back to all changes in this revision

Viewing changes to src/VBox/Devices/Network/slirp/slirp.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-12-18 16:44:29 UTC
  • mfrom: (0.3.3 upstream) (0.4.6 squeeze)
  • Revision ID: james.westby@ubuntu.com-20091218164429-jd34ccexpv5na11a
Tags: 3.1.2-dfsg-1ubuntu1
* Merge from Debian unstable (LP: #498219), remaining changes:
  - Disable update action
    - debian/patches/u01-disable-update-action.dpatch
  - VirtualBox should go in Accessories, not in System tools (LP: #288590)
    - debian/virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add Apport hook
    - debian/virtualbox-ose.files/source_virtualbox-ose.py
    - debian/virtualbox-ose.install
  - Add Launchpad integration
    - debian/control
    - debian/lpi-bug.xpm
    - debian/patches/u02-lp-integration.dpatch
* Fixes the following bugs:
  - Kernel module fails to build with Linux >= 2.6.32 (LP: #474625)
  - X.Org drivers need to be rebuilt against X-Server 1.7 (LP: #495935)
  - The *-source packages try to build the kernel modules even though the
    kernel headers aren't available (LP: #473334)
* Replace *-source packages with transitional packages for *-dkms.
* Adapt u01-disable-update-action.dpatch and u02-lp-integration.dpatch for
  new upstream version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
127
127
# include <stdlib.h>
128
128
#endif
129
129
 
130
 
#include <stdio.h>
131
130
#include <errno.h>
132
131
 
 
132
 
133
133
#ifndef HAVE_MEMMOVE
134
134
# define memmove(x, y, z) bcopy(y, x, z)
135
135
#endif
263
263
int get_dns_addr(PNATState pData, struct in_addr *pdns_addr);
264
264
 
265
265
/* cksum.c */
 
266
#ifndef VBOX_WITH_SLIRP_BSD_MBUF
266
267
int cksum(struct mbuf *m, int len);
 
268
#else
 
269
typedef uint16_t u_short;
 
270
typedef unsigned int u_int;
 
271
#include "in_cksum.h"
 
272
#endif
267
273
 
268
274
/* if.c */
269
275
void if_init (PNATState);
279
285
 
280
286
/* ip_output.c */
281
287
int ip_output (PNATState, struct socket *, struct mbuf *);
 
288
int ip_output0 (PNATState, struct socket *, struct mbuf *, int urg);
282
289
 
283
290
/* tcp_input.c */
284
291
int tcp_reass (PNATState, struct tcpcb *, struct tcphdr *, int *, struct mbuf *);
307
314
int tcp_ctl (PNATState, struct socket *);
308
315
struct tcpcb *tcp_drop(PNATState, struct tcpcb *tp, int err);
309
316
 
310
 
uint16_t slirp_get_service(int proto, uint16_t dport, uint16_t sport);
311
 
 
312
317
/*slirp.c*/
313
318
void slirp_arp_who_has(PNATState pData, uint32_t dst);
314
 
int slirp_update_arp_cache(PNATState pData, uint32_t dst, const uint8_t *mac);
 
319
int slirp_arp_cache_update(PNATState pData, uint32_t dst, const uint8_t *mac);
 
320
void slirp_arp_cache_add(PNATState pData, uint32_t ip, const uint8_t *ether);
 
321
int slirp_arp_cache_update_or_add(PNATState pData, uint32_t dst, const uint8_t *mac);
315
322
#define MIN_MRU 128
316
323
#define MAX_MRU 16384
317
324
 
330
337
# endif
331
338
#endif
332
339
 
333
 
# ifdef VBOX_WITHOUT_SLIRP_CLIENT_ETHER
334
 
#  define ETH_ALEN        6
335
 
#  define ETH_HLEN        14
 
340
# define ETH_ALEN        6
 
341
# define ETH_HLEN        14
336
342
 
337
 
#  define ARPOP_REQUEST   1               /* ARP request                  */
338
 
#  define ARPOP_REPLY     2               /* ARP reply                    */
 
343
# define ARPOP_REQUEST   1               /* ARP request                  */
 
344
# define ARPOP_REPLY     2               /* ARP reply                    */
339
345
 
340
346
struct ethhdr
341
347
{
344
350
    unsigned short  h_proto;                    /* packet type ID field */
345
351
};
346
352
AssertCompileSize(struct ethhdr, 14);
347
 
# endif
348
 
#if defined(VBOX_WITH_SLIRP_ALIAS) && defined(VBOX_SLIRP_ALIAS)
 
353
 
 
354
/*
 
355
 * (vvl) externing of sscanf.
 
356
 */
 
357
int sscanf(const char *s, const char *format, ...);
 
358
 
 
359
#if defined(VBOX_SLIRP_ALIAS) || defined(VBOX_SLIRP_BSD)
349
360
 
350
361
# define ip_next(ip) (void *)((uint8_t *)(ip) + ((ip)->ip_hl << 2))
351
362
# define udp_next(udp) (void *)((uint8_t *)&((struct udphdr *)(udp))[1] )
354
365
# define NO_FW_PUNCH
355
366
 
356
367
# ifdef alias_addr
357
 
#  error  alias_addr has already defined!!!
 
368
#  ifndef VBOX_SLIRP_BSD
 
369
#   error alias_addr has already defined!!!
 
370
#  else
 
371
#   undef alias_addr
 
372
#  endif
358
373
# endif
359
374
 
360
375
# define arc4random() RTRandU32()
369
384
# endif
370
385
 
371
386
# define strncasecmp RTStrNICmp
 
387
# define stderr NULL
 
388
# define stdout NULL
372
389
 
373
390
# ifdef DEBUG
374
 
# define LIBALIAS_DEBUG
375
 
# ifdef fprintf
376
 
#  undef fprintf
377
 
# endif
378
 
# ifdef fflush
379
 
#  undef fflush
380
 
# endif
381
 
# ifdef printf
382
 
#  undef printf
383
 
# endif
384
 
#define fflush(x) do{}while(0)
385
 
# define fprintf vbox_slirp_fprintf
386
 
# define printf vbox_slirp_printf
387
 
static void vbox_slirp_printV(char *format, va_list args)
388
 
{
389
 
    char buffer[1024];
390
 
    memset(buffer, 0, 1024);
391
 
    RTStrPrintfV(buffer, 1024, format, args);
392
 
 
393
 
    Log2(("NAT:ALIAS: %s\n", buffer));
394
 
}
395
 
static void vbox_slirp_printf(char *format, ...)
396
 
{
397
 
    va_list args;
398
 
    va_start(args, format);
399
 
    vbox_slirp_printV(format, args);
400
 
    va_end(args);
401
 
}
402
 
static void vbox_slirp_fprintf(void *ignored, char *format, ...)
403
 
{
404
 
    va_list args;
405
 
    va_start(args, format);
406
 
    vbox_slirp_printV(format, args);
407
 
    va_end(args);
408
 
}
409
 
# endif /* DEBUG */
410
 
#endif /*VBOX_WITH_SLIRP_ALIAS && VBOX_SLIRP_ALIAS*/
411
 
 
412
 
#ifdef VBOX_WITH_SLIRP_ALIAS
 
391
#  define LIBALIAS_DEBUG
 
392
# endif
 
393
 
 
394
# define fflush(x) do{} while(0)
 
395
# include "ext.h"
 
396
#endif /*VBOX_SLIRP_ALIAS*/
 
397
 
 
398
#ifdef VBOX_WITH_SLIRP_BSD_MBUF
 
399
/* @todo might be useful to make it configurable,
 
400
 * especially in terms of Intnet behind NAT
 
401
 */
 
402
# define maxusers 32
 
403
# define max_protohdr 0
 
404
/* @todo (r=vvl) for now ignore value,
 
405
 * latter here should be fetching of tuning parameters entered
 
406
 */
 
407
# define TUNABLE_INT_FETCH(name, pval) do { } while (0)
 
408
# define SYSCTL_PROC(a0, a1, a2, a3, a4, a5, a6, a7, a8)
 
409
# define SYSCTL_STRUCT(a0, a1, a2, a3, a4, a5, a6)
 
410
# define SYSINIT(a0, a1, a2, a3, a4)
 
411
# define sysctl_handle_int(a0, a1, a2, a3) 0
 
412
# define EVENTHANDLER_INVOKE(a) do{}while(0)
 
413
# define EVENTHANDLER_REGISTER(a0, a1, a2, a3) do{}while(0)
 
414
# define KASSERT AssertMsg
 
415
 
 
416
struct dummy_req
 
417
{
 
418
    void *newptr;
 
419
};
 
420
 
 
421
#define SYSCTL_HANDLER_ARGS PNATState pData, void *oidp, struct dummy_req *req
 
422
 
 
423
void mbuf_init(void *);
 
424
# define cksum(m, len) in_cksum_skip((m), (len), 0)
 
425
#endif
 
426
 
413
427
int ftp_alias_load(PNATState);
414
428
int ftp_alias_unload(PNATState);
415
429
int nbt_alias_load(PNATState);
416
430
int nbt_alias_unload(PNATState);
417
 
#endif /*VBOX_WITH_SLIRP_ALIAS*/
418
 
 
 
431
int dns_alias_load(PNATState);
 
432
int dns_alias_unload(PNATState);
 
433
int slirp_arp_lookup_ip_by_ether(PNATState, const uint8_t *, uint32_t *);
 
434
int slirp_arp_lookup_ether_by_ip(PNATState, uint32_t, uint8_t *);
419
435
#endif
420
436