瀏覽代碼

print_lib: relocated to archive

Daniel-Constantin Mierla 9 月之前
父節點
當前提交
e2e380b6ce

+ 11 - 0
src/modules/print_lib/CMakeLists.txt

@@ -0,0 +1,11 @@
+cmake_minimum_required(VERSION 3.10)
+
+project(print_lib)
+
+file(GLOB SRC_FILES "*.c")
+
+add_library(print_lib SHARED ${SRC_FILES})
+# lib_print is the name of the library that we are linking against
+# (src/lib/print)
+# if `print` it will pick the module one
+target_link_libraries(print_lib PRIVATE kamailio lib_print)

+ 17 - 0
src/modules/print_lib/Makefile

@@ -0,0 +1,17 @@
+#
+# print_lib example module makefile
+#
+# 
+# WARNING: do not run this directly, it should be run by the main Makefile
+
+include ../../Makefile.defs
+auto_gen=
+NAME=print_lib.so
+LIBS=
+SERLIBPATH=../../lib
+# ser libraries, in the format path/shortname , where shortname is
+# what will be used for -l
+SER_LIBS=$(SERLIBPATH)/print/print
+
+
+include ../../Makefile.modules

+ 53 - 0
src/modules/print_lib/README

@@ -0,0 +1,53 @@
+Print_lib Module
+
+Andrei Pelinescu-Onciul
+
+   FhG FOKUS
+
+   Copyright © 2003 FhG FOKUS
+     __________________________________________________________________
+
+   Table of Contents
+
+   1. Admin Guide
+
+        1. Overview
+        2. Functions
+
+              2.1. print_stderr(txt)
+
+   List of Examples
+
+   1.1. print_stderr usage
+
+Chapter 1. Admin Guide
+
+   Table of Contents
+
+   1. Overview
+   2. Functions
+
+        2.1. print_stderr(txt)
+
+1. Overview
+
+   This is an example module. It implements only one function that prints
+   its string parameter to stderr (it won't work if server is started in
+   daemon mode). Its purpose is to show how to link to an internal library
+   (lib/print).
+
+2. Functions
+
+   2.1. print_stderr(txt)
+
+2.1.  print_stderr(txt)
+
+   Prints string to stderr.
+
+   Meaning of the parameters is as follows:
+     * txt - string to be printed.
+
+   Example 1.1. print_stderr usage
+...
+print_stderr("The answer is 42\n");
+...

+ 4 - 0
src/modules/print_lib/doc/Makefile

@@ -0,0 +1,4 @@
+docs = print_lib.xml
+
+docbook_dir = ../../../../doc/docbook
+include $(docbook_dir)/Makefile.module

+ 34 - 0
src/modules/print_lib/doc/functions.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<section id="print_lib.functions" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <sectioninfo>
+    </sectioninfo>
+
+    <title>Functions</title>
+
+    <section id="print_lib.print">
+	<title>
+	    <function>print_stderr(txt)</function>
+	</title>
+	<para>
+	    Prints string to stderr.
+	</para>
+	<para>Meaning of the parameters is as follows:</para>
+	<itemizedlist>
+	    <listitem>
+		<para><emphasis>txt</emphasis> - string to be printed.
+		</para>
+	    </listitem>
+	</itemizedlist>
+	<example>
+	    <title><function>print_stderr</function> usage</title>
+	    <programlisting>
+...
+print_stderr("The answer is 42\n");
+...
+	    </programlisting>
+	</example>
+    </section>
+</section>

+ 40 - 0
src/modules/print_lib/doc/print_lib.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
+   "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
+
+<book id="print" xmlns:xi="http://www.w3.org/2001/XInclude">
+    <bookinfo>
+        <title>Print_lib Module</title>
+	<authorgroup>
+	    <author>
+		<firstname>Andrei</firstname>
+		<surname>Pelinescu-Onciul</surname>
+		<affiliation><orgname>FhG FOKUS</orgname></affiliation>
+		<address>
+		    <email>[email protected]</email>
+		</address>
+	    </author>
+	</authorgroup>
+	<copyright>
+	    <year>2003</year>
+	    <holder>FhG FOKUS</holder>
+	</copyright>
+    </bookinfo>
+    <toc></toc>
+
+    <chapter>
+	<title>Admin Guide</title>
+    <section id="print_lib.overview">
+	<title>Overview</title>
+	<para>
+	    This is an example module. It implements only one function that
+	    prints its string parameter to stderr (it won't work if server is
+		started in daemon mode). Its purpose is to show how to link to
+		an internal library (lib/print).
+	</para>
+    </section>
+
+    <xi:include href="functions.xml"/>
+    </chapter>
+</book>
+

+ 74 - 0
src/modules/print_lib/print_lib.c

@@ -0,0 +1,74 @@
+/*$Id$
+ *
+ * Example library using ser module (it doesn't do anything useful)
+ *
+ *
+ * Copyright (C) 2007 iptelorg GmbH
+ *
+ * This file is part of ser, a free SIP server.
+ *
+ * ser is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version
+ *
+ * For a license to use the ser software under conditions
+ * other than those described here, or to purchase support for this
+ * software, please contact iptel.org by e-mail at the following addresses:
+ *    [email protected]
+ *
+ * ser is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+/* History:
+ * --------
+ *  2007-03-16  created by andrei
+ */
+
+
+#include "../../core/sr_module.h"
+#include "../../lib/print/print.h"
+
+MODULE_VERSION
+
+static int print_f(struct sip_msg *, char *, char *);
+static int mod_init(void);
+
+
+static cmd_export_t cmds[] = {
+		{"print_stderr", print_f, 1, 0, 0, REQUEST_ROUTE}, {0, 0, 0, 0, 0, 0}};
+
+static param_export_t params[] = {{0, 0, 0}};
+
+struct module_exports exports = {
+		"print_stderr",	 /* module name */
+		DEFAULT_DLFLAGS, /* dlopen flags */
+		cmds,			 /* exported functions */
+		params,			 /* exported parameters */
+		0,				 /* RPC method exports */
+		0,				 /* exported pseudo-variables */
+		0,				 /* response handling function */
+		mod_init,		 /* module initialization function */
+		0,				 /* per-child init function */
+		0				 /* module destroy function */
+};
+
+
+static int mod_init(void)
+{
+	stderr_println("print_lib - initializing");
+	return 0;
+}
+
+
+static int print_f(struct sip_msg *msg, char *s1, char *s2)
+{
+	stderr_println(s1);
+	return 1;
+}