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