Blame SOURCES/restore-api-compatibility.patch

0e57ae
diff --git a/cmdlang/Makefile.am b/cmdlang/Makefile.am
0e57ae
index 9326e3ea..192623f3 100644
0e57ae
--- a/cmdlang/Makefile.am
0e57ae
+++ b/cmdlang/Makefile.am
0e57ae
@@ -2,8 +2,6 @@
0e57ae
 LIB_VERSION = 0.0.5
0e57ae
 LD_VERSION = 0:5:0
0e57ae
 
0e57ae
-noinst_HEADERS = cmdlang.h
0e57ae
-
0e57ae
 AM_CFLAGS = -Wall -Wsign-compare -I$(top_builddir)/include \
0e57ae
 	-I$(top_srcdir)/include \
0e57ae
 	-DIPMI_CHECK_LOCKS $(GLIB_CFLAGS) \
0e57ae
diff --git a/cmdlang/cmd_conn.c b/cmdlang/cmd_conn.c
0e57ae
index cdd700b6..338e9c77 100644
0e57ae
--- a/cmdlang/cmd_conn.c
0e57ae
+++ b/cmdlang/cmd_conn.c
0e57ae
@@ -38,7 +38,6 @@
0e57ae
 #include <stdio.h>
0e57ae
 #include <OpenIPMI/ipmiif.h>
0e57ae
 #include <OpenIPMI/ipmi_cmdlang.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static void
0e57ae
 con_list_handler(ipmi_domain_t *domain, int conn, void *cb_data)
0e57ae
diff --git a/cmdlang/cmd_control.c b/cmdlang/cmd_control.c
0e57ae
index feefe73c..06cf1c27 100644
0e57ae
--- a/cmdlang/cmd_control.c
0e57ae
+++ b/cmdlang/cmd_control.c
0e57ae
@@ -41,7 +41,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static void
0e57ae
 control_list_handler(ipmi_entity_t *entity, ipmi_control_t *control,
0e57ae
diff --git a/cmdlang/cmd_domain.c b/cmdlang/cmd_domain.c
0e57ae
index dec5765d..0ca0b25d 100644
0e57ae
--- a/cmdlang/cmd_domain.c
0e57ae
+++ b/cmdlang/cmd_domain.c
0e57ae
@@ -45,7 +45,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 /* Don't pollute the namespace iwth ipmi_fru_t. */
0e57ae
 void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
0e57ae
diff --git a/cmdlang/cmd_entity.c b/cmdlang/cmd_entity.c
0e57ae
index e88854ac..a5ad1475 100644
0e57ae
--- a/cmdlang/cmd_entity.c
0e57ae
+++ b/cmdlang/cmd_entity.c
0e57ae
@@ -42,7 +42,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 /* Don't pollute the namespace iwth ipmi_fru_t. */
0e57ae
 void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
0e57ae
diff --git a/cmdlang/cmd_fru.c b/cmdlang/cmd_fru.c
0e57ae
index 5cc2a1ac..cea4b70c 100644
0e57ae
--- a/cmdlang/cmd_fru.c
0e57ae
+++ b/cmdlang/cmd_fru.c
0e57ae
@@ -43,7 +43,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 /* Don't pollute the namespace iwth ipmi_fru_t. */
0e57ae
 void ipmi_cmdlang_dump_fru_info(ipmi_cmd_info_t *cmd_info, ipmi_fru_t *fru);
0e57ae
diff --git a/cmdlang/cmd_lanparm.c b/cmdlang/cmd_lanparm.c
0e57ae
index b6e86701..7afd7dd2 100644
0e57ae
--- a/cmdlang/cmd_lanparm.c
0e57ae
+++ b/cmdlang/cmd_lanparm.c
0e57ae
@@ -44,7 +44,6 @@
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
 #include <OpenIPMI/internal/locked_list.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static locked_list_t *lancs;
0e57ae
 
0e57ae
diff --git a/cmdlang/cmd_mc.c b/cmdlang/cmd_mc.c
0e57ae
index 645506e7..0a3f6440 100644
0e57ae
--- a/cmdlang/cmd_mc.c
0e57ae
+++ b/cmdlang/cmd_mc.c
0e57ae
@@ -47,7 +47,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static void
0e57ae
 mc_list_handler(ipmi_domain_t *domain, ipmi_mc_t *mc, void *cb_data)
0e57ae
diff --git a/cmdlang/cmd_pef.c b/cmdlang/cmd_pef.c
0e57ae
index c8503299..47ab2bd1 100644
0e57ae
--- a/cmdlang/cmd_pef.c
0e57ae
+++ b/cmdlang/cmd_pef.c
0e57ae
@@ -44,7 +44,6 @@
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
 #include <OpenIPMI/internal/locked_list.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static locked_list_t *pefs;
0e57ae
 
0e57ae
diff --git a/cmdlang/cmd_pet.c b/cmdlang/cmd_pet.c
0e57ae
index 5730159e..77d3f90d 100644
0e57ae
--- a/cmdlang/cmd_pet.c
0e57ae
+++ b/cmdlang/cmd_pet.c
0e57ae
@@ -40,7 +40,6 @@
0e57ae
 #include <OpenIPMI/ipmi_pet.h>
0e57ae
 #include <OpenIPMI/ipmi_mc.h>
0e57ae
 #include <OpenIPMI/ipmi_cmdlang.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 
0e57ae
 static void
0e57ae
diff --git a/cmdlang/cmd_sel.c b/cmdlang/cmd_sel.c
0e57ae
index 660f58a7..545b12f2 100644
0e57ae
--- a/cmdlang/cmd_sel.c
0e57ae
+++ b/cmdlang/cmd_sel.c
0e57ae
@@ -42,7 +42,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static int
0e57ae
 discrete_event_handler(ipmi_sensor_t         *sensor,
0e57ae
diff --git a/cmdlang/cmd_sensor.c b/cmdlang/cmd_sensor.c
0e57ae
index a4abc77c..99b8a634 100644
0e57ae
--- a/cmdlang/cmd_sensor.c
0e57ae
+++ b/cmdlang/cmd_sensor.c
0e57ae
@@ -41,7 +41,6 @@
0e57ae
 
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static void
0e57ae
 sensor_list_handler(ipmi_entity_t *entity, ipmi_sensor_t *sensor,
0e57ae
diff --git a/cmdlang/cmd_solparm.c b/cmdlang/cmd_solparm.c
0e57ae
index f584f8f3..df32c3f7 100644
0e57ae
--- a/cmdlang/cmd_solparm.c
0e57ae
+++ b/cmdlang/cmd_solparm.c
0e57ae
@@ -44,7 +44,6 @@
0e57ae
 /* Internal includes, do not use in your programs */
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
 #include <OpenIPMI/internal/locked_list.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 static locked_list_t *solcs;
0e57ae
 
0e57ae
diff --git a/cmdlang/cmdlang.c b/cmdlang/cmdlang.c
0e57ae
index b690e24c..416fce7f 100644
0e57ae
--- a/cmdlang/cmdlang.c
0e57ae
+++ b/cmdlang/cmdlang.c
0e57ae
@@ -54,7 +54,6 @@
0e57ae
 #include <OpenIPMI/internal/ipmi_locks.h>
0e57ae
 #include <OpenIPMI/internal/ipmi_malloc.h>
0e57ae
 #include <OpenIPMI/internal/winsock_compat.h>
0e57ae
-#include "cmdlang.h"
0e57ae
 
0e57ae
 /*
0e57ae
  * This is the value passed to a command handler.
0e57ae
@@ -2480,6 +2479,8 @@ event_done(ipmi_cmdlang_t *cmdlang)
0e57ae
 	    ipmi_mem_free(cmdlang->errstr);
0e57ae
     } else if (ipmi_cmdlang_event_rpt) {
0e57ae
 	ipmi_cmdlang_event_rpt(event);
0e57ae
+    } else if (ipmi_cmdlang_report_event) {
0e57ae
+	ipmi_cmdlang_report_event(event);
0e57ae
     }
0e57ae
 
0e57ae
     if (cmdlang->objstr)
0e57ae
diff --git a/cmdlang/cmdlang.h b/cmdlang/cmdlang.h
0e57ae
deleted file mode 100644
0e57ae
index 0758cb5d..00000000
0e57ae
--- a/cmdlang/cmdlang.h
0e57ae
+++ /dev/null
0e57ae
@@ -1,43 +0,0 @@
0e57ae
-/*
0e57ae
- * cmdlang.h
0e57ae
- *
0e57ae
- * A command interpreter for OpenIPMI
0e57ae
- *
0e57ae
- * Author: MontaVista Software, Inc.
0e57ae
- *         Corey Minyard <minyard@mvista.com>
0e57ae
- *         source@mvista.com
0e57ae
- *
0e57ae
- * Copyright 2020 MontaVista Software Inc.
0e57ae
- *
0e57ae
- *  This program is free software; you can redistribute it and/or
0e57ae
- *  modify it under the terms of the GNU Lesser General Public License
0e57ae
- *  as published by the Free Software Foundation; either version 2 of
0e57ae
- *  the License, or (at your option) any later version.
0e57ae
- *
0e57ae
- *
0e57ae
- *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
0e57ae
- *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0e57ae
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0e57ae
- *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0e57ae
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0e57ae
- *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
0e57ae
- *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0e57ae
- *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
0e57ae
- *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
0e57ae
- *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0e57ae
- *
0e57ae
- *  You should have received a copy of the GNU Lesser General Public
0e57ae
- *  License along with this program; if not, write to the Free
0e57ae
- *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0e57ae
- */
0e57ae
-
0e57ae
-#ifndef CMDLANG_H
0e57ae
-#define CMDLANG_H
0e57ae
-
0e57ae
-/* Used to log errors inside the cmdlang. */
0e57ae
-void ipmi_cmdlang_global_err(char *objstr,
0e57ae
-			     char *location,
0e57ae
-			     char *errstr,
0e57ae
-			     int  errval);
0e57ae
-
0e57ae
-#endif /* CMDLANG_H */
0e57ae
diff --git a/include/OpenIPMI/Makefile.am b/include/OpenIPMI/Makefile.am
0e57ae
index 8e86afc8..644cc84a 100644
0e57ae
--- a/include/OpenIPMI/Makefile.am
0e57ae
+++ b/include/OpenIPMI/Makefile.am
0e57ae
@@ -8,7 +8,7 @@ pkginclude_HEADERS = \
0e57ae
 	ipmi_conn.h	ipmi_lan.h	ipmi_pet.h	ipmi_ui.h	\
0e57ae
 	ipmi_debug.h	ipmi_lanparm.h	ipmi_picmg.h	ipmi_string.h	\
0e57ae
 	ipmi_sol.h	ipmi_solparm.h	ipmi_tcl.h	deprecator.h	\
0e57ae
-	dllvisibility.h
0e57ae
+	dllvisibility.h	weaksyms.h
0e57ae
 
0e57ae
 SUBDIRS = internal
0e57ae
 
0e57ae
diff --git a/include/OpenIPMI/ipmi_cmdlang.h b/include/OpenIPMI/ipmi_cmdlang.h
0e57ae
index 80e5cb8a..682279e9 100644
0e57ae
--- a/include/OpenIPMI/ipmi_cmdlang.h
0e57ae
+++ b/include/OpenIPMI/ipmi_cmdlang.h
0e57ae
@@ -35,6 +35,7 @@
0e57ae
 #define OPENIPMI_CMDLANG_H
0e57ae
 
0e57ae
 #include <OpenIPMI/dllvisibility.h>
0e57ae
+#include <OpenIPMI/weaksyms.h>
0e57ae
 #include <OpenIPMI/selector.h>
0e57ae
 #include <OpenIPMI/ipmi_bits.h>
0e57ae
 #include <OpenIPMI/ipmi_types.h>
0e57ae
@@ -44,6 +45,14 @@
0e57ae
 extern "C" {
0e57ae
 #endif
0e57ae
 
0e57ae
+#ifdef BUILDING_IPMI_CMDLANG_DLL
0e57ae
+  #define IPMI_CMDLANG_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
0e57ae
+  #define IPMI_CMDLANG_WEAK_DEFAULT(ret, sym, decl) IPMI_WEAK_DLL_DEFAULT(ret, sym, decl)
0e57ae
+#else
0e57ae
+  #define IPMI_CMDLANG_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
0e57ae
+  #define IPMI_CMDLANG_WEAK_DEFAULT(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
0e57ae
+#endif
0e57ae
+
0e57ae
 #if defined _WIN32 || defined __CYGWIN__
0e57ae
   #ifdef BUILDING_IPMI_CMDLANG_DLL
0e57ae
     #ifdef __GNUC__
0e57ae
@@ -427,10 +436,15 @@ extern void (*ipmi_cmdlang_err_rpt)(char *objstr,
0e57ae
 				    char *location,
0e57ae
 				    char *errstr,
0e57ae
 				    int  errval);
0e57ae
+IPMI_CMDLANG_WEAK_DEFAULT(void, ipmi_cmdlang_global_err, (char *objstr,
0e57ae
+							  char *location,
0e57ae
+							  char *errstr,
0e57ae
+							  int  errval));
0e57ae
 
0e57ae
 /* Supplied by the user to report events. */
0e57ae
 IPMI_CMDLANG_DLL_PUBLIC
0e57ae
 extern void (*ipmi_cmdlang_event_rpt)(ipmi_cmdlang_event_t *event);
0e57ae
+IPMI_CMDLANG_WEAK(void, ipmi_cmdlang_report_event, (ipmi_cmdlang_event_t *event));
0e57ae
 
0e57ae
 /* In callbacks, you must use these to lock the cmd_info structure. */
0e57ae
 IPMI_CMDLANG_DLL_PUBLIC
0e57ae
diff --git a/include/OpenIPMI/ipmi_posix.h b/include/OpenIPMI/ipmi_posix.h
0e57ae
index f3000eca..0d7e82ee 100644
0e57ae
--- a/include/OpenIPMI/ipmi_posix.h
0e57ae
+++ b/include/OpenIPMI/ipmi_posix.h
0e57ae
@@ -43,6 +43,19 @@
0e57ae
 extern "C" {
0e57ae
 #endif
0e57ae
 
0e57ae
+/* These are the defined OS handlers for POSIX with and without
0e57ae
+   threading.  If you use these (and thus link with the OpenIPMIposix
0e57ae
+   or OpenIPMIpthread libraries) you must provide posix_vlog().  It is
0e57ae
+   not provided by the library. */
0e57ae
+/* DEPRECATED - This should no longer be used, you should use the
0e57ae
+   OS-handler function to set your log handler.  If you do not supply
0e57ae
+   your own os_vlog handler, logs will go to stderr.  If you supply a
0e57ae
+   posix_vlog handler and don't call set_log_handler in the OS handler,
0e57ae
+   posix_vlog() will still be used. */
0e57ae
+IPMI_SEL_WEAK(void, posix_vlog, (char *format,
0e57ae
+				 enum ipmi_log_type_e log_type,
0e57ae
+				 va_list ap));
0e57ae
+
0e57ae
 /* Non-threaded os handler operations */
0e57ae
 
0e57ae
 /**********************************************************************
0e57ae
diff --git a/include/OpenIPMI/selector.h b/include/OpenIPMI/selector.h
0e57ae
index ca1f7f9c..d803d9f4 100644
0e57ae
--- a/include/OpenIPMI/selector.h
0e57ae
+++ b/include/OpenIPMI/selector.h
0e57ae
@@ -46,6 +46,14 @@
0e57ae
 typedef int sigset_t;
0e57ae
 #endif
0e57ae
 
0e57ae
+#include <OpenIPMI/weaksyms.h>
0e57ae
+
0e57ae
+#if defined BUILDING_IPMI_SELECTOR_DLL
0e57ae
+  #define IPMI_SEL_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
0e57ae
+#else
0e57ae
+  #define IPMI_SEL_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
0e57ae
+#endif
0e57ae
+
0e57ae
 #if defined _WIN32 || defined __CYGWIN__
0e57ae
   #ifdef BUILDING_IPMI_SELECTOR_DLL
0e57ae
     #ifdef __GNUC__
0e57ae
diff --git a/include/OpenIPMI/weaksyms.h b/include/OpenIPMI/weaksyms.h
0e57ae
new file mode 100644
0e57ae
index 00000000..07004243
0e57ae
--- /dev/null
0e57ae
+++ b/include/OpenIPMI/weaksyms.h
0e57ae
@@ -0,0 +1,80 @@
0e57ae
+/*
0e57ae
+ * weaksyms.h
0e57ae
+ *
0e57ae
+ * MontaVista IPMI weak symbol defines
0e57ae
+ *
0e57ae
+ * Author: MontaVista Software, Inc.
0e57ae
+ *         Corey Minyard <minyard@mvista.com>
0e57ae
+ *         source@mvista.com
0e57ae
+ *
0e57ae
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
0e57ae
+ *
0e57ae
+ * This software is available to you under a choice of one of two
0e57ae
+ * licenses.  You may choose to be licensed under the terms of the GNU
0e57ae
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
0e57ae
+ * license below.  The following disclamer applies to both licenses:
0e57ae
+ *
0e57ae
+ *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
0e57ae
+ *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0e57ae
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0e57ae
+ *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0e57ae
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0e57ae
+ *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
0e57ae
+` *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0e57ae
+ *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
0e57ae
+ *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
0e57ae
+ *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0e57ae
+ *
0e57ae
+ * GNU Lesser General Public Licence
0e57ae
+ *
0e57ae
+ *  This program is free software; you can redistribute it and/or
0e57ae
+ *  modify it under the terms of the GNU Lesser General Public License
0e57ae
+ *  as published by the Free Software Foundation; either version 2 of
0e57ae
+ *  the License, or (at your option) any later version.
0e57ae
+ *
0e57ae
+ *  You should have received a copy of the GNU Lesser General Public
0e57ae
+ *  License along with this program; if not, write to the Free
0e57ae
+ *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0e57ae
+ *
0e57ae
+ * Modified BSD Licence
0e57ae
+ *
0e57ae
+ * Redistribution and use in source and binary forms, with or without
0e57ae
+ * modification, are permitted provided that the following conditions
0e57ae
+ * are met:
0e57ae
+ *
0e57ae
+ *   1. Redistributions of source code must retain the above copyright
0e57ae
+ *      notice, this list of conditions and the following disclaimer.
0e57ae
+ *   2. Redistributions in binary form must reproduce the above
0e57ae
+ *      copyright notice, this list of conditions and the following
0e57ae
+ *      disclaimer in the documentation and/or other materials provided
0e57ae
+ *      with the distribution.
0e57ae
+ *   3. The name of the author may not be used to endorse or promote
0e57ae
+ *      products derived from this software without specific prior
0e57ae
+ *      written permission.
0e57ae
+ */
0e57ae
+
0e57ae
+#ifndef __WEAKSYMS_H
0e57ae
+#define __WEAKSYMS_H
0e57ae
+
0e57ae
+#include <stddef.h>
0e57ae
+
0e57ae
+#if defined _WIN32 || defined __CYGWIN__
0e57ae
+  // Calling back to user code not supported, set the weak symbol to NULL always.
0e57ae
+  #define IPMI_WEAK_DLL(ret, sym, decl) static ret (*sym)decl = NULL
0e57ae
+  // Weak symbol with a default value, do not set to zero
0e57ae
+  #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) ret sym decl
0e57ae
+  #define IPMI_WEAK_USER(ret, sym, decl) // Nothing, omit the prototype
0e57ae
+#else
0e57ae
+  #ifdef __GNUC__
0e57ae
+    #define IPMI_WEAK_DLL(ret, sym, decl) __attribute__ ((weak)) ret sym decl
0e57ae
+    #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
0e57ae
+    #define IPMI_WEAK_USER(ret, sym, decl) ret sym decl
0e57ae
+  #else
0e57ae
+    // Weak symbol not supported as we can not generate #pragma nor _Pragma from cpp
0e57ae
+    #define IPMI_WEAK_DLL(ret, sym, decl) static ret (*sym)decl = NULL
0e57ae
+    #define IPMI_WEAK_DLL_DEFAULT(ret, sym, decl) ret sym decl
0e57ae
+    #define IPMI_WEAK_USER(ret, sym, decl) // Nothing, omit the prototype
0e57ae
+  #endif
0e57ae
+#endif
0e57ae
+
0e57ae
+#endif /* __WEAKSYMS_H */
0e57ae
diff --git a/lanserv/Makefile.am b/lanserv/Makefile.am
0e57ae
index 371ec52d..e4409423 100644
0e57ae
--- a/lanserv/Makefile.am
0e57ae
+++ b/lanserv/Makefile.am
0e57ae
@@ -30,7 +30,7 @@ bin_PROGRAMS = ipmi_sim $(IPMILAN_PROG)
0e57ae
 
0e57ae
 noinst_PROGRAMS = ipmi_checksum
0e57ae
 
0e57ae
-noinst_HEADERS = emu.h bmc.h ipmi_sim.h sol.h
0e57ae
+noinst_HEADERS = emu.h bmc.h ipmi_sim.h sol.h callback.h
0e57ae
 
0e57ae
 libIPMIlanserv_la_SOURCES = lanserv_ipmi.c lanserv_asf.c priv_table.c \
0e57ae
 	lanserv_oem_force.c lanserv_config.c config.c serv.c serial_ipmi.c \
0e57ae
diff --git a/lanserv/OpenIPMI/Makefile.am b/lanserv/OpenIPMI/Makefile.am
0e57ae
index 80fb44ea..f9fbf2cf 100644
0e57ae
--- a/lanserv/OpenIPMI/Makefile.am
0e57ae
+++ b/lanserv/OpenIPMI/Makefile.am
0e57ae
@@ -1,3 +1,3 @@
0e57ae
 
0e57ae
 pkginclude_HEADERS = lanserv.h serserv.h serv.h extcmd.h persist.h msg.h \
0e57ae
-	mcserv.h ipmbserv.h lanserv_dllvisibility.h
0e57ae
+	mcserv.h ipmbserv.h lanserv_dllvisibility.h lanserv_weaksyms.h
0e57ae
diff --git a/lanserv/OpenIPMI/lanserv.h b/lanserv/OpenIPMI/lanserv.h
0e57ae
index 57ed757e..867f2741 100644
0e57ae
--- a/lanserv/OpenIPMI/lanserv.h
0e57ae
+++ b/lanserv/OpenIPMI/lanserv.h
0e57ae
@@ -57,6 +57,7 @@
0e57ae
 #define __LANSERV_H
0e57ae
 
0e57ae
 #include <OpenIPMI/lanserv_dllvisibility.h>
0e57ae
+#include <OpenIPMI/lanserv_weaksyms.h>
0e57ae
 
0e57ae
 #include <stdint.h>
0e57ae
 #include <stdio.h>
0e57ae
@@ -236,6 +237,8 @@ typedef struct ipmi_tick_handler_s {
0e57ae
     struct ipmi_tick_handler_s *next;
0e57ae
 } ipmi_tick_handler_t;
0e57ae
 
0e57ae
+IPMI_LANSERV_WEAK(void, ipmi_register_tick_handler, (ipmi_tick_handler_t *handler));
0e57ae
+
0e57ae
 typedef struct oem_handlers_s
0e57ae
 {
0e57ae
     void *oem_data;
0e57ae
diff --git a/lanserv/OpenIPMI/lanserv_weaksyms.h b/lanserv/OpenIPMI/lanserv_weaksyms.h
0e57ae
new file mode 100644
0e57ae
index 00000000..e68d6bd2
0e57ae
--- /dev/null
0e57ae
+++ b/lanserv/OpenIPMI/lanserv_weaksyms.h
0e57ae
@@ -0,0 +1,67 @@
0e57ae
+/*
0e57ae
+ * lanserv.h
0e57ae
+ *
0e57ae
+ * MontaVista IPMI LAN server include file
0e57ae
+ *
0e57ae
+ * Author: MontaVista Software, Inc.
0e57ae
+ *         Corey Minyard <minyard@mvista.com>
0e57ae
+ *         source@mvista.com
0e57ae
+ *
0e57ae
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
0e57ae
+ *
0e57ae
+ * This software is available to you under a choice of one of two
0e57ae
+ * licenses.  You may choose to be licensed under the terms of the GNU
0e57ae
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
0e57ae
+ * license below.  The following disclamer applies to both licenses:
0e57ae
+ *
0e57ae
+ *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
0e57ae
+ *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0e57ae
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0e57ae
+ *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0e57ae
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0e57ae
+ *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
0e57ae
+` *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0e57ae
+ *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
0e57ae
+ *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
0e57ae
+ *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0e57ae
+ *
0e57ae
+ * GNU Lesser General Public Licence
0e57ae
+ *
0e57ae
+ *  This program is free software; you can redistribute it and/or
0e57ae
+ *  modify it under the terms of the GNU Lesser General Public License
0e57ae
+ *  as published by the Free Software Foundation; either version 2 of
0e57ae
+ *  the License, or (at your option) any later version.
0e57ae
+ *
0e57ae
+ *  You should have received a copy of the GNU Lesser General Public
0e57ae
+ *  License along with this program; if not, write to the Free
0e57ae
+ *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0e57ae
+ *
0e57ae
+ * Modified BSD Licence
0e57ae
+ *
0e57ae
+ * Redistribution and use in source and binary forms, with or without
0e57ae
+ * modification, are permitted provided that the following conditions
0e57ae
+ * are met:
0e57ae
+ *
0e57ae
+ *   1. Redistributions of source code must retain the above copyright
0e57ae
+ *      notice, this list of conditions and the following disclaimer.
0e57ae
+ *   2. Redistributions in binary form must reproduce the above
0e57ae
+ *      copyright notice, this list of conditions and the following
0e57ae
+ *      disclaimer in the documentation and/or other materials provided
0e57ae
+ *      with the distribution.
0e57ae
+ *   3. The name of the author may not be used to endorse or promote
0e57ae
+ *      products derived from this software without specific prior
0e57ae
+ *      written permission.
0e57ae
+ */
0e57ae
+
0e57ae
+#ifndef __LANSERV_WEAKSYMS_H
0e57ae
+#define __LANSERV_WEAKSYMS_H
0e57ae
+
0e57ae
+#include <OpenIPMI/weaksyms.h>
0e57ae
+
0e57ae
+#if defined BUILDING_IPMI_LANSERV_DLL
0e57ae
+  #define IPMI_LANSERV_WEAK(ret, sym, decl) IPMI_WEAK_DLL(ret, sym, decl)
0e57ae
+#else
0e57ae
+  #define IPMI_LANSERV_WEAK(ret, sym, decl) IPMI_WEAK_USER(ret, sym, decl)
0e57ae
+#endif
0e57ae
+
0e57ae
+#endif /* __LANSERV_WEAKSYMS_H */
0e57ae
diff --git a/lanserv/OpenIPMI/mcserv.h b/lanserv/OpenIPMI/mcserv.h
0e57ae
index c2a04648..de8d1440 100644
0e57ae
--- a/lanserv/OpenIPMI/mcserv.h
0e57ae
+++ b/lanserv/OpenIPMI/mcserv.h
0e57ae
@@ -84,6 +84,19 @@ void ipmi_mc_set_chassis_control_func(lmc_data_t *mc,
0e57ae
 						 void *cb_data),
0e57ae
 				      void *cb_data);
0e57ae
 
0e57ae
+IPMI_LANSERV_WEAK(int, ipmi_mc_alloc_unconfigured, (sys_data_t *sys, unsigned char ipmb,
0e57ae
+                                                    lmc_data_t **rmc));
0e57ae
+
0e57ae
+IPMI_LANSERV_WEAK(unsigned char, ipmi_mc_get_ipmb, (lmc_data_t *mc));
0e57ae
+IPMI_LANSERV_WEAK(channel_t **, ipmi_mc_get_channelset, (lmc_data_t *mc));
0e57ae
+IPMI_LANSERV_WEAK(ipmi_sol_t *, ipmi_mc_get_sol, (lmc_data_t *mc));
0e57ae
+IPMI_LANSERV_WEAK(startcmd_t *, ipmi_mc_get_startcmdinfo, (lmc_data_t *mc));
0e57ae
+IPMI_LANSERV_WEAK(user_t *, ipmi_mc_get_users, (lmc_data_t *mc));
0e57ae
+IPMI_LANSERV_WEAK(pef_data_t *, ipmi_mc_get_pef, (lmc_data_t *mc));
0e57ae
+
0e57ae
+IPMI_LANSERV_WEAK(void, ipmi_resend_atn, (channel_t *chan));
0e57ae
+IPMI_LANSERV_WEAK(msg_t *, ipmi_mc_get_next_recv_q, (channel_t *chan));
0e57ae
+
0e57ae
 /*
0e57ae
  * FRUs have a semaphore that can be use to grant exclusive access.
0e57ae
  * The semaphore is attempted to get before read and write operations,
0e57ae
@@ -165,6 +178,8 @@ int check_msg_length(msg_t         *msg,
0e57ae
 		     unsigned int  len,
0e57ae
 		     unsigned char *rdata,
0e57ae
 		     unsigned int  *rdata_len);
0e57ae
+IPMI_LANSERV_WEAK(void, ipmi_set_chassis_control_prog,
0e57ae
+                  (lmc_data_t *mc, const char *prog));
0e57ae
 
0e57ae
 void ipmi_mc_set_dev_revision(lmc_data_t *mc, unsigned char dev_revision);
0e57ae
 void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major,
0e57ae
@@ -172,6 +187,10 @@ void ipmi_mc_set_fw_revision(lmc_data_t *mc, unsigned char fw_revision_major,
0e57ae
 void ipmi_mc_set_aux_fw_revision(lmc_data_t *mc,
0e57ae
 				 unsigned char aux_fw_revision[4]);
0e57ae
 const char *get_lanserv_version(void);
0e57ae
+IPMI_LANSERV_WEAK(int, sol_read_config,
0e57ae
+                  (char **tokptr, sys_data_t *sys, const char **err));
0e57ae
+
0e57ae
+IPMI_LANSERV_WEAK(int, ipmi_mc_users_changed, (lmc_data_t *mc));
0e57ae
 
0e57ae
 /*
0e57ae
  * Types and functions for registering handlers with the MC emulator.
0e57ae
diff --git a/lanserv/callback.h b/lanserv/callback.h
0e57ae
new file mode 100644
0e57ae
index 00000000..eb9f18fa
0e57ae
--- /dev/null
0e57ae
+++ b/lanserv/callback.h
0e57ae
@@ -0,0 +1,68 @@
0e57ae
+/*
0e57ae
+ * callback.h
0e57ae
+ *
0e57ae
+ * MontaVista IPMI LAN server include file
0e57ae
+ *
0e57ae
+ * Author: MontaVista Software, Inc.
0e57ae
+ *         Corey Minyard <minyard@mvista.com>
0e57ae
+ *         source@mvista.com
0e57ae
+ *
0e57ae
+ * Copyright 2003,2004,2005 MontaVista Software Inc.
0e57ae
+ *
0e57ae
+ * This software is available to you under a choice of one of two
0e57ae
+ * licenses.  You may choose to be licensed under the terms of the GNU
0e57ae
+ * Lesser General Public License (GPL) Version 2 or the modified BSD
0e57ae
+ * license below.  The following disclamer applies to both licenses:
0e57ae
+ *
0e57ae
+ *  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
0e57ae
+ *  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
0e57ae
+ *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
0e57ae
+ *  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
0e57ae
+ *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
0e57ae
+ *  BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
0e57ae
+` *  OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
0e57ae
+ *  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
0e57ae
+ *  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
0e57ae
+ *  USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0e57ae
+ *
0e57ae
+ * GNU Lesser General Public Licence
0e57ae
+ *
0e57ae
+ *  This program is free software; you can redistribute it and/or
0e57ae
+ *  modify it under the terms of the GNU Lesser General Public License
0e57ae
+ *  as published by the Free Software Foundation; either version 2 of
0e57ae
+ *  the License, or (at your option) any later version.
0e57ae
+ *
0e57ae
+ *  You should have received a copy of the GNU Lesser General Public
0e57ae
+ *  License along with this program; if not, write to the Free
0e57ae
+ *  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
0e57ae
+ *
0e57ae
+ * Modified BSD Licence
0e57ae
+ *
0e57ae
+ * Redistribution and use in source and binary forms, with or without
0e57ae
+ * modification, are permitted provided that the following conditions
0e57ae
+ * are met:
0e57ae
+ *
0e57ae
+ *   1. Redistributions of source code must retain the above copyright
0e57ae
+ *      notice, this list of conditions and the following disclaimer.
0e57ae
+ *   2. Redistributions in binary form must reproduce the above
0e57ae
+ *      copyright notice, this list of conditions and the following
0e57ae
+ *      disclaimer in the documentation and/or other materials provided
0e57ae
+ *      with the distribution.
0e57ae
+ *   3. The name of the author may not be used to endorse or promote
0e57ae
+ *      products derived from this software without specific prior
0e57ae
+ *      written permission.
0e57ae
+ */
0e57ae
+
0e57ae
+#ifndef __CALLBACK_H
0e57ae
+#define __CALLBACK_H
0e57ae
+
0e57ae
+/*
0e57ae
+ * Macros to get callbacks that exist either as function pointers in some structure
0e57ae
+ * or as functions in user code.
0e57ae
+ * Pointers take precedence, functions exist for backward compatibility.
0e57ae
+ */
0e57ae
+
0e57ae
+#define LANSERV_CB(obj, field, name) ( (obj)->field ? (obj)->field : (name) )
0e57ae
+#define LANSERV_CB_IPMI(obj, name) LANSERV_CB(obj, name, ipmi_ ## name)
0e57ae
+
0e57ae
+#endif /* __CALLBACK_H */
0e57ae
diff --git a/lanserv/config.c b/lanserv/config.c
0e57ae
index 453750eb..d59e93fe 100644
0e57ae
--- a/lanserv/config.c
0e57ae
+++ b/lanserv/config.c
0e57ae
@@ -65,6 +65,9 @@
0e57ae
 #include <OpenIPMI/serserv.h>
0e57ae
 #include <OpenIPMI/ipmbserv.h>
0e57ae
 #include <OpenIPMI/persist.h>
0e57ae
+#include <OpenIPMI/mcserv.h>
0e57ae
+
0e57ae
+#include "callback.h"
0e57ae
 
0e57ae
 void
0e57ae
 read_persist_users(sys_data_t *sys)
0e57ae
@@ -80,11 +83,11 @@ read_persist_users(sys_data_t *sys)
0e57ae
 	if (!mc)
0e57ae
 	    continue;
0e57ae
 
0e57ae
-	p = read_persist("users.mc%2.2x", sys->mc_get_ipmb(mc));
0e57ae
+	p = read_persist("users.mc%2.2x", LANSERV_CB_IPMI(sys, mc_get_ipmb)(mc));
0e57ae
 	if (!p)
0e57ae
 	    continue;
0e57ae
 
0e57ae
-	users = sys->mc_get_users(mc);
0e57ae
+	users = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
0e57ae
 	for (j = 0; j <= MAX_USERS; j++) {
0e57ae
 	    void *data;
0e57ae
 	    unsigned int len;
0e57ae
@@ -124,14 +127,14 @@ write_persist_users(sys_data_t *sys)
0e57ae
 	user_t *users;
0e57ae
 	persist_t *p;
0e57ae
 
0e57ae
-	if (!mc || !sys->mc_users_changed(mc))
0e57ae
+	if (!mc || !LANSERV_CB_IPMI(sys, mc_users_changed)(mc))
0e57ae
 	    continue;
0e57ae
 
0e57ae
-	p = alloc_persist("users.mc%2.2x", sys->mc_get_ipmb(mc));
0e57ae
+	p = alloc_persist("users.mc%2.2x", LANSERV_CB_IPMI(sys, mc_get_ipmb)(mc));
0e57ae
 	if (!p)
0e57ae
 	    return ENOMEM;
0e57ae
 
0e57ae
-	users = sys->mc_get_users(mc);
0e57ae
+	users = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
0e57ae
 	for (j = 0; j <= MAX_USERS; j++) {
0e57ae
 	    add_persist_int(p, users[j].valid, "%d.valid", j);
0e57ae
 	    add_persist_int(p, users[j].link_auth, "%d.link_auth", j);
0e57ae
@@ -834,12 +837,13 @@ read_config(sys_data_t *sys,
0e57ae
 	} else if (strcmp(tok, "serial") == 0) {
0e57ae
 	    err = serserv_read_config(&tokptr, sys, &errstr);
0e57ae
 	} else if (strcmp(tok, "sol") == 0) {
0e57ae
-	    err = sys->sol_read_config(&tokptr, sys, &errstr);
0e57ae
+	    err = LANSERV_CB(sys, sol_read_config, sol_read_config)
0e57ae
+			(&tokptr, sys, &errstr);
0e57ae
 	} else if (strcmp(tok, "chassis_control") == 0) {
0e57ae
 	    char *prog;
0e57ae
 	    err = get_delim_str(&tokptr, &prog, &errstr);
0e57ae
 	    if (!err)
0e57ae
-		sys->set_chassis_control_prog(sys->mc, prog);
0e57ae
+		LANSERV_CB_IPMI(sys, set_chassis_control_prog)(sys->mc, prog);
0e57ae
 	} else if (strcmp(tok, "name") == 0) {
0e57ae
 	    err = get_delim_str(&tokptr, &sys->name, &errstr);
0e57ae
 	} else if (strcmp(tok, "startcmd") == 0) {
0e57ae
@@ -860,7 +864,7 @@ read_config(sys_data_t *sys,
0e57ae
 	    err = get_uchar(&tokptr, &ipmb, &errstr);
0e57ae
 	    if (!err) {
0e57ae
 		lmc_data_t *mc;
0e57ae
-		err = sys->mc_alloc_unconfigured(sys, ipmb, &mc);
0e57ae
+		err = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, ipmb, &mc);
0e57ae
 		if (err == ENOMEM) {
0e57ae
 		    errstr = "Out of memory";
0e57ae
 		    err = -1;
0e57ae
@@ -869,11 +873,11 @@ read_config(sys_data_t *sys,
0e57ae
 		    err = -1;
0e57ae
 		} else {
0e57ae
 		    sys->mc = mc;
0e57ae
-		    sys->cusers = sys->mc_get_users(mc);
0e57ae
-		    sys->chan_set = sys->mc_get_channelset(mc);
0e57ae
-		    sys->cpef = sys->mc_get_pef(mc);
0e57ae
-		    sys->startcmd = sys->mc_get_startcmdinfo(mc);
0e57ae
-		    sys->sol = sys->mc_get_sol(mc);
0e57ae
+		    sys->cusers = LANSERV_CB_IPMI(sys, mc_get_users)(mc);
0e57ae
+		    sys->chan_set = LANSERV_CB_IPMI(sys, mc_get_channelset)(mc);
0e57ae
+		    sys->cpef = LANSERV_CB_IPMI(sys, mc_get_pef)(mc);
0e57ae
+		    sys->startcmd = LANSERV_CB_IPMI(sys, mc_get_startcmdinfo)(mc);
0e57ae
+		    sys->sol = LANSERV_CB_IPMI(sys, mc_get_sol)(mc);
0e57ae
 		}
0e57ae
 	    }
0e57ae
 	} else if (strcmp(tok, "console") == 0) {
0e57ae
diff --git a/lanserv/lanserv_ipmi.c b/lanserv/lanserv_ipmi.c
0e57ae
index ccd60015..c3c2cdbe 100644
0e57ae
--- a/lanserv/lanserv_ipmi.c
0e57ae
+++ b/lanserv/lanserv_ipmi.c
0e57ae
@@ -73,6 +73,9 @@
0e57ae
 
0e57ae
 #include <OpenIPMI/persist.h>
0e57ae
 #include <OpenIPMI/extcmd.h>
0e57ae
+#include <OpenIPMI/mcserv.h>
0e57ae
+
0e57ae
+#include "callback.h"
0e57ae
 
0e57ae
 static int
0e57ae
 is_authval_null(uint8_t *val)
0e57ae
@@ -512,7 +515,7 @@ lan_return_rsp(channel_t *chan, msg_t *msg, rsp_msg_t *rsp)
0e57ae
 
0e57ae
     return_rsp(lan, msg, NULL, rsp);
0e57ae
 
0e57ae
-    msg = lan->sysinfo->mc_get_next_recv_q(chan);
0e57ae
+    msg = LANSERV_CB_IPMI(lan->sysinfo, mc_get_next_recv_q)(chan);
0e57ae
     if (!msg)
0e57ae
 	return;
0e57ae
     while (msg) {
0e57ae
@@ -531,7 +534,7 @@ lan_return_rsp(channel_t *chan, msg_t *msg, rsp_msg_t *rsp)
0e57ae
 
0e57ae
 	chan->free(chan, msg);
0e57ae
 
0e57ae
-	msg = lan->sysinfo->mc_get_next_recv_q(chan);
0e57ae
+	msg = LANSERV_CB_IPMI(lan->sysinfo, mc_get_next_recv_q)(chan);
0e57ae
     }
0e57ae
     if (chan->recv_in_q)
0e57ae
 	chan->recv_in_q(chan, 0);
0e57ae
@@ -729,7 +732,7 @@ handle_get_channel_cipher_suites(lanserv_data_t *lan, msg_t *msg)
0e57ae
     if (chan == 0xe)
0e57ae
 	chan = lan->channel.channel_num;
0e57ae
 
0e57ae
-    channels = lan->sysinfo->mc_get_channelset(lan->channel.mc);
0e57ae
+    channels = LANSERV_CB_IPMI(lan->sysinfo, mc_get_channelset)(lan->channel.mc);
0e57ae
     channel = channels[chan];
0e57ae
     if (!channel) {
0e57ae
 	return_err(lan, msg, NULL, IPMI_NOT_PRESENT_CC);
0e57ae
@@ -3202,7 +3205,7 @@ ipmi_lan_init(lanserv_data_t *lan)
0e57ae
 
0e57ae
     lan->tick_handler.handler = ipmi_lan_tick;
0e57ae
     lan->tick_handler.info = lan;
0e57ae
-    lan->sysinfo->register_tick_handler(&lan->tick_handler);
0e57ae
+    LANSERV_CB_IPMI(lan->sysinfo, register_tick_handler)(&lan->tick_handler);
0e57ae
 
0e57ae
  out:
0e57ae
     return rv;
0e57ae
diff --git a/lanserv/marvell-bmc/marvell_mod.c b/lanserv/marvell-bmc/marvell_mod.c
0e57ae
index b5b15e05..41a07b5c 100644
0e57ae
--- a/lanserv/marvell-bmc/marvell_mod.c
0e57ae
+++ b/lanserv/marvell-bmc/marvell_mod.c
0e57ae
@@ -72,6 +72,7 @@
0e57ae
 #include <OpenIPMI/lanserv.h>
0e57ae
 #include <OpenIPMI/mcserv.h>
0e57ae
 
0e57ae
+#include "callback.h"
0e57ae
 #include "wiw.h"
0e57ae
 
0e57ae
 #define PVERSION "2.0.12"
0e57ae
@@ -3052,7 +3053,7 @@ ipmi_sim_module_init(sys_data_t *sys, const char *initstr_i)
0e57ae
 	}
0e57ae
     }
0e57ae
 
0e57ae
-    rv = sys->mc_alloc_unconfigured(sys, 0x20, &bmc_mc);
0e57ae
+    rv = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, 0x20, &bmc_mc);
0e57ae
     if (rv) {
0e57ae
 	sys->log(sys, OS_ERROR, NULL,
0e57ae
 		 "Unable to allocate an mc: %s", strerror(rv));
0e57ae
@@ -3099,7 +3100,7 @@ ipmi_sim_module_init(sys_data_t *sys, const char *initstr_i)
0e57ae
 	    }
0e57ae
 	}
0e57ae
 
0e57ae
-	rv = sys->mc_alloc_unconfigured(sys, board_ipmb[num], &mc);
0e57ae
+	rv = LANSERV_CB_IPMI(sys, mc_alloc_unconfigured)(sys, board_ipmb[num], &mc);
0e57ae
 	if (rv) {
0e57ae
 	    sys->log(sys, OS_ERROR, NULL,
0e57ae
 		     "Unable to allocate an mc: %s", strerror(rv));
0e57ae
@@ -3285,7 +3286,7 @@ ipmi_sim_module_post_init(sys_data_t *sys)
0e57ae
 	 */
0e57ae
 	unsigned char data[13];
0e57ae
 	memset(data, 0, sizeof(data));
0e57ae
-	data[4] = sys->mc_get_ipmb(bmc_mc);
0e57ae
+	data[4] = LANSERV_CB_IPMI(sys, mc_get_ipmb)(bmc_mc);
0e57ae
 	data[5] = 0; /* LUN */
0e57ae
 	data[6] = 0x04; /* Event message revision for IPMI 1.5. */
0e57ae
 	data[7] = 0x1d; /* System boot initiated. */
0e57ae
diff --git a/lanserv/serial_ipmi.c b/lanserv/serial_ipmi.c
0e57ae
index 8ba8f7d0..b7255341 100644
0e57ae
--- a/lanserv/serial_ipmi.c
0e57ae
+++ b/lanserv/serial_ipmi.c
0e57ae
@@ -63,6 +63,7 @@
0e57ae
 #include <OpenIPMI/ipmi_mc.h>
0e57ae
 #include <OpenIPMI/ipmi_msgbits.h>
0e57ae
 #include <OpenIPMI/serserv.h>
0e57ae
+#include <OpenIPMI/mcserv.h>
0e57ae
 
0e57ae
 #define EVENT_BUFFER_GLOBAL_ENABLE	(1 << 2)
0e57ae
 #define EVENT_LOG_GLOBAL_ENABLE		(1 << 3)
0e57ae
@@ -1008,6 +1009,8 @@ vm_connected(serserv_data_t *si)
0e57ae
     si->connected = 1;
0e57ae
     if (si->sysinfo->resend_atn)
0e57ae
 	si->sysinfo->resend_atn(&si->channel);
0e57ae
+    else if (ipmi_resend_atn)
0e57ae
+	ipmi_resend_atn(&si->channel);
0e57ae
 }
0e57ae
 
0e57ae
 static void
0e57ae
diff --git a/unix/posix_os_hnd.c b/unix/posix_os_hnd.c
0e57ae
index f84ba270..54910c4b 100644
0e57ae
--- a/unix/posix_os_hnd.c
0e57ae
+++ b/unix/posix_os_hnd.c
0e57ae
@@ -376,6 +376,8 @@ sposix_vlog(os_handler_t         *handler,
0e57ae
 
0e57ae
     if (log_handler)
0e57ae
 	log_handler(handler, format, log_type, ap);
0e57ae
+    else if (posix_vlog)
0e57ae
+	posix_vlog((char *) format, log_type, ap);
0e57ae
     else
0e57ae
 	default_vlog(format, log_type, ap);
0e57ae
 }
0e57ae
diff --git a/unix/posix_thread_os_hnd.c b/unix/posix_thread_os_hnd.c
0e57ae
index cb315c5e..3bec32f6 100644
0e57ae
--- a/unix/posix_thread_os_hnd.c
0e57ae
+++ b/unix/posix_thread_os_hnd.c
0e57ae
@@ -377,6 +377,8 @@ sposix_vlog(os_handler_t         *handler,
0e57ae
 
0e57ae
     if (log_handler)
0e57ae
 	log_handler(handler, format, log_type, ap);
0e57ae
+    else if (posix_vlog)
0e57ae
+	posix_vlog((char *) format, log_type, ap);
0e57ae
     else
0e57ae
 	default_vlog(format, log_type, ap);
0e57ae
 }