/*-
* Copyright (c) 2005 Paolo Pisati <piso@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
*/
#ifndef VBOX
__FBSDID("$FreeBSD: src/sys/netinet/libalias/alias_mod.c,v 1.3.8.1 2009/04/15 03:14:26 kensmith Exp $");
#ifdef _KERNEL
#else
#include <stdio.h>
#include <string.h>
#include <errno.h>
#endif
#include <netinet/in_systm.h>
#ifdef _KERNEL
#else
#include "alias_local.h"
#include "alias_mod.h"
#endif
/* Protocol and userland module handlers chains. */
#else /* VBOX */
# include <slirp.h>
# include "alias_local.h"
# include "alias_mod.h"
#endif /* VBOX */
#ifdef _KERNEL
#endif
#ifdef _KERNEL
#define LIBALIAS_RWLOCK_INIT() \
#define LIBALIAS_WLOCK_ASSERT() \
static __inline void
LIBALIAS_RLOCK(void)
{
}
static __inline void
LIBALIAS_RUNLOCK(void)
{
}
static __inline void
LIBALIAS_WLOCK(void)
{
}
static __inline void
LIBALIAS_WUNLOCK(void)
{
}
static void
_handler_chain_init(void)
{
if (!rw_initialized(&handler_rw))
}
static void
_handler_chain_destroy(void)
{
if (rw_initialized(&handler_rw))
}
#else /* VBOX */
# define LIBALIAS_WLOCK_ASSERT() ;
# define LIBALIAS_RLOCK() \
do { \
} while (0)
# define LIBALIAS_RUNLOCK() \
do { \
} while (0)
# define LIBALIAS_WLOCK() \
do { \
} while (0)
# define LIBALIAS_WUNLOCK() \
do { \
} while (0)
# define _handler_chain_init() ;
# define _handler_chain_destroy() ;
#endif
void
handler_chain_init(void)
{
}
void
handler_chain_destroy(void)
{
}
static int
#ifdef VBOX
#else
_attach_handler(struct proto_handler *p)
#endif
{
return (EEXIST); /* Priority conflict. */
LIST_INSERT_BEFORE(b, p, entries);
return (0);
}
/* If the conditions above do not work, we should keep the last
* element of the list in order to insert *p right after it. */
handler_chain_tail = b;
}
/* End of list or found right position, inserts here. */
if (handler_chain_tail)
else
return (0);
}
static int
#ifdef VBOX
#else
_detach_handler(struct proto_handler *p)
#endif
{
if (b == p) {
LIST_REMOVE(b, entries);
return (0);
}
}
return (ENOENT); /* Handler not found. */
}
int
#ifdef VBOX
#else
#endif
{
for (i=0; 1; i++) {
break;
#ifdef VBOX
#else
#endif
if (error != 0)
break;
}
return (error);
}
int
#ifdef VBOX
#else
#endif
{
for (i=0; 1; i++) {
break;
#ifdef VBOX
#else
#endif
if (error != 0)
break;
}
return (error);
}
int
#ifdef VBOX
#else
#endif
{
#ifdef VBOX
#else
#endif
return (error);
}
int
struct alias_data *ad)
{
#ifdef VBOX
#endif
struct proto_handler *p;
break;
}
}
return (error);
}
struct proto_handler *
#ifdef VBOX
#else
first_handler(void)
#endif
{
return (LIST_FIRST(&handler_chain));
}
/* Dll manipulation code - this code is not thread safe... */
int
{
struct dll *b;
return (EEXIST); /* Dll name conflict. */
}
return (0);
}
void *
detach_dll(char *p)
{
error = b;
break;
}
return (error);
}
struct dll *
walk_dll_chain(void)
{
struct dll *t;
t = SLIST_FIRST(&dll_chain);
if (t == NULL)
return (NULL);
return (t);
}