Browse code

core, lib, modules: restructured source code tree

- new folder src/ to hold the source code for main project applications
- main.c is in src/
- all core files are subfolder are in src/core/
- modules are in src/modules/
- libs are in src/lib/
- application Makefiles are in src/
- application binary is built in src/ (src/kamailio)

Daniel-Constantin Mierla authored on 07/12/2016 11:03:51
Showing 1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,124 +0,0 @@
1
-/* 
2
- * Kamailio Remote Procedure Call Interface
3
- *
4
- * Copyright (C) 2005 iptelorg GmbH
5
- *
6
- * This file is part of Kamailio, a free SIP server.
7
- *
8
- * Kamailio is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version
12
- *
13
- * Kamailio is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License 
19
- * along with this program; if not, write to the Free Software 
20
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
21
- */
22
-
23
-/*!
24
-* \file
25
-* \brief Kamailio core :: RPC, Remote procedure call interface
26
-* \ingroup core
27
-* Module: \ref core
28
-*/
29
-
30
-#ifndef _RPC_H
31
-#define _RPC_H
32
-
33
-/*
34
- * TODO: Add the possibility to add printf-like formatted string to fault
35
- */
36
-
37
-enum rpc_flags {
38
-	RET_ARRAY = (1 << 0),
39
-	RET_VALUE = (1 << 1)
40
-};
41
-
42
-typedef enum rpc_capabilities {
43
-	RPC_DELAYED_REPLY = (1 <<0)  /* delayed reply support */
44
-} rpc_capabilities_t;
45
-
46
-struct rpc_delayed_ctx;
47
-
48
-
49
-/* Send the result to the caller */
50
-typedef int (*rpc_send_f)(void* ctx);                                      /*!< Send the reply to the client */
51
-typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /*!< Signal a failure to the client */
52
-typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /*!< Add a new piece of data to the result */
53
-typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /*!< Retrieve request parameters */
54
-typedef int (*rpc_rpl_printf_f)(void* ctx, char* fmt, ...);                /*!< Add printf-like formated data to the result set */
55
-typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /*!< Add fields in a structure */
56
-typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...);                 /*!< Add values in an array */
57
-typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /*!< Scan attributes of a structure */
58
-typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /*!< Struct version of rpc_printf */
59
-
60
-/* returns the supported capabilities */
61
-typedef rpc_capabilities_t (*rpc_capabilities_f)(void* ctx);
62
-/* create a special "context" for delayed replies */
63
-typedef struct rpc_delayed_ctx* (*rpc_delayed_ctx_new_f)(void* ctx);
64
-/* close the special "context" for delayed replies */
65
-typedef void (*rpc_delayed_ctx_close_f)(struct rpc_delayed_ctx* dctx);
66
-
67
-/*
68
- * RPC context, this is what RPC functions get as a parameter and use
69
- * it to obtain the value of the parameters of the call and reference
70
- * to the result structure that will be returned to the caller
71
- */
72
-typedef struct rpc {
73
-	rpc_fault_f fault;
74
-	rpc_send_f send;
75
-	rpc_add_f add;
76
-	rpc_scan_f scan;
77
-	rpc_rpl_printf_f rpl_printf;
78
-	rpc_struct_add_f struct_add;
79
-	rpc_array_add_f array_add;
80
-	rpc_struct_scan_f struct_scan;
81
-	rpc_struct_printf_f struct_printf;
82
-	rpc_capabilities_f capabilities;
83
-	rpc_delayed_ctx_new_f delayed_ctx_new;
84
-	rpc_delayed_ctx_close_f delayed_ctx_close;
85
-} rpc_t;
86
-
87
-
88
-typedef struct rpc_delayed_ctx{
89
-	rpc_t rpc;
90
-	void* reply_ctx;
91
-	/* more private data might follow */
92
-} rpc_delayed_ctx_t;
93
-
94
-
95
-/**
96
- * RPC Function Prototype
97
- */
98
-typedef void (*rpc_function_t)(rpc_t* rpc, void* ctx);
99
-
100
-/**
101
- * RPC callback context.
102
- *
103
- * Defines a convenient way of packing an rpc callback
104
- * (rpc_function_t) parameters and it's not used/needed
105
- * by the rpc api/interface.
106
- */
107
-typedef struct rpc_cb_ctx {
108
-	rpc_t *rpc;
109
-	void *c;
110
-} rpc_cb_ctx_t;
111
-
112
-
113
-/**
114
- * Remote Procedure Call Export
115
- */
116
-typedef struct rpc_export {
117
-	const char* name;        /*!< Name of the RPC function (null terminated) */
118
-	rpc_function_t function; /*!< Pointer to the function */
119
-	const char** doc_str;  /*!< Documentation strings, method signature and description */
120
-	unsigned int flags;      /*!< Various flags, reserved for future use */
121
-} rpc_export_t;
122
-
123
-
124
-#endif /* _RPC_H */
Browse code

Core Update of doxygen, removal of history, changing "ser" to "kamailio"

Olle E. Johansson authored on 03/01/2015 14:03:24
Showing 1 changed files
... ...
@@ -1,22 +1,16 @@
1
-/* $Id$
2
- *
3
- * SER Remote Procedure Call Interface
1
+/* 
2
+ * Kamailio Remote Procedure Call Interface
4 3
  *
5 4
  * Copyright (C) 2005 iptelorg GmbH
6 5
  *
7
- * This file is part of ser, a free SIP server.
6
+ * This file is part of Kamailio, a free SIP server.
8 7
  *
9
- * ser is free software; you can redistribute it and/or modify
8
+ * Kamailio is free software; you can redistribute it and/or modify
10 9
  * it under the terms of the GNU General Public License as published by
11 10
  * the Free Software Foundation; either version 2 of the License, or
12 11
  * (at your option) any later version
13 12
  *
14
- * For a license to use the ser software under conditions
15
- * other than those described here, or to purchase support for this
16
- * software, please contact iptel.org by e-mail at the following addresses:
17
- *    info@iptel.org
18
- *
19
- * ser is distributed in the hope that it will be useful,
13
+ * Kamailio is distributed in the hope that it will be useful,
20 14
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
21 15
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22 16
  * GNU General Public License for more details.
... ...
@@ -26,6 +20,13 @@
26 20
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 21
  */
28 22
 
23
+/*!
24
+* \file
25
+* \brief Kamailio core :: RPC, Remote procedure call interface
26
+* \ingroup core
27
+* Module: \ref core
28
+*/
29
+
29 30
 #ifndef _RPC_H
30 31
 #define _RPC_H
31 32
 
... ...
@@ -46,15 +47,15 @@ struct rpc_delayed_ctx;
46 47
 
47 48
 
48 49
 /* Send the result to the caller */
49
-typedef int (*rpc_send_f)(void* ctx);                                      /* Send the reply to the client */
50
-typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /* Signal a failure to the client */
51
-typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /* Add a new piece of data to the result */
52
-typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /* Retrieve request parameters */
53
-typedef int (*rpc_rpl_printf_f)(void* ctx, char* fmt, ...);                /* Add printf-like formated data to the result set */
54
-typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Add fields in a structure */
55
-typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...);                 /* Add values in an array */
56
-typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /* Scan attributes of a structure */
57
-typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct version of rpc_printf */
50
+typedef int (*rpc_send_f)(void* ctx);                                      /*!< Send the reply to the client */
51
+typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /*!< Signal a failure to the client */
52
+typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /*!< Add a new piece of data to the result */
53
+typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /*!< Retrieve request parameters */
54
+typedef int (*rpc_rpl_printf_f)(void* ctx, char* fmt, ...);                /*!< Add printf-like formated data to the result set */
55
+typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /*!< Add fields in a structure */
56
+typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...);                 /*!< Add values in an array */
57
+typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /*!< Scan attributes of a structure */
58
+typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /*!< Struct version of rpc_printf */
58 59
 
59 60
 /* returns the supported capabilities */
60 61
 typedef rpc_capabilities_t (*rpc_capabilities_f)(void* ctx);
... ...
@@ -91,13 +92,12 @@ typedef struct rpc_delayed_ctx{
91 92
 } rpc_delayed_ctx_t;
92 93
 
93 94
 
94
-/*
95
+/**
95 96
  * RPC Function Prototype
96 97
  */
97
-
98 98
 typedef void (*rpc_function_t)(rpc_t* rpc, void* ctx);
99 99
 
100
-/*
100
+/**
101 101
  * RPC callback context.
102 102
  *
103 103
  * Defines a convenient way of packing an rpc callback
... ...
@@ -110,14 +110,14 @@ typedef struct rpc_cb_ctx {
110 110
 } rpc_cb_ctx_t;
111 111
 
112 112
 
113
-/*
113
+/**
114 114
  * Remote Procedure Call Export
115 115
  */
116 116
 typedef struct rpc_export {
117
-	const char* name;        /* Name of the RPC function (null terminated) */
118
-	rpc_function_t function; /* Pointer to the function */
119
-	const char** doc_str;  /* Documentation strings, method signature and description */
120
-	unsigned int flags;      /* Various flags, reserved for future use */
117
+	const char* name;        /*!< Name of the RPC function (null terminated) */
118
+	rpc_function_t function; /*!< Pointer to the function */
119
+	const char** doc_str;  /*!< Documentation strings, method signature and description */
120
+	unsigned int flags;      /*!< Various flags, reserved for future use */
121 121
 } rpc_export_t;
122 122
 
123 123
 
Browse code

core: rpc - replaced api member printf with rpl_printf

- clang is throwing error: no member named '__printf_chk' in 'struct rpc'
- reported in FS#457, follwing report on Debian:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=755852

Daniel-Constantin Mierla authored on 01/09/2014 17:16:54
Showing 1 changed files
... ...
@@ -50,7 +50,7 @@ typedef int (*rpc_send_f)(void* ctx);                                      /* Se
50 50
 typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /* Signal a failure to the client */
51 51
 typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /* Add a new piece of data to the result */
52 52
 typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /* Retrieve request parameters */
53
-typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);                    /* Add printf-like formated data to the result set */
53
+typedef int (*rpc_rpl_printf_f)(void* ctx, char* fmt, ...);                /* Add printf-like formated data to the result set */
54 54
 typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Add fields in a structure */
55 55
 typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...);                 /* Add values in an array */
56 56
 typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /* Scan attributes of a structure */
... ...
@@ -73,7 +73,7 @@ typedef struct rpc {
73 73
 	rpc_send_f send;
74 74
 	rpc_add_f add;
75 75
 	rpc_scan_f scan;
76
-	rpc_printf_f printf;
76
+	rpc_rpl_printf_f rpl_printf;
77 77
 	rpc_struct_add_f struct_add;
78 78
 	rpc_array_add_f array_add;
79 79
 	rpc_struct_scan_f struct_scan;
Browse code

all: updated FSF address in GPL text

Anthony Messina authored on 04/07/2014 09:36:37 • Daniel-Constantin Mierla committed on 04/07/2014 09:37:36
Showing 1 changed files
... ...
@@ -23,7 +23,7 @@
23 23
  *
24 24
  * You should have received a copy of the GNU General Public License 
25 25
  * along with this program; if not, write to the Free Software 
26
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
26
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
27 27
  */
28 28
 
29 29
 #ifndef _RPC_H
Browse code

core: new rpc api to add values in an array

- memeber named array_add

Daniel-Constantin Mierla authored on 23/04/2014 20:59:22
Showing 1 changed files
... ...
@@ -51,7 +51,8 @@ typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /* Si
51 51
 typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /* Add a new piece of data to the result */
52 52
 typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /* Retrieve request parameters */
53 53
 typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);                    /* Add printf-like formated data to the result set */
54
-typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Create a new structure */
54
+typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Add fields in a structure */
55
+typedef int (*rpc_array_add_f)(void* ctx, char* fmt, ...);                 /* Add values in an array */
55 56
 typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /* Scan attributes of a structure */
56 57
 typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct version of rpc_printf */
57 58
 
... ...
@@ -74,6 +75,7 @@ typedef struct rpc {
74 75
 	rpc_scan_f scan;
75 76
 	rpc_printf_f printf;
76 77
 	rpc_struct_add_f struct_add;
78
+	rpc_array_add_f array_add;
77 79
 	rpc_struct_scan_f struct_scan;
78 80
 	rpc_struct_printf_f struct_printf;
79 81
 	rpc_capabilities_f capabilities;
Browse code

core: rpc - adding rpc_cb_ctx_t

- rpc_cb_ctx_t is a convenient way of packing an rpc
callback (rpc_function_t) parameters and it's not
used/needed by the rpc api/interface.

Ovidiu Sas authored on 29/06/2010 13:53:05
Showing 1 changed files
... ...
@@ -95,6 +95,18 @@ typedef struct rpc_delayed_ctx{
95 95
 
96 96
 typedef void (*rpc_function_t)(rpc_t* rpc, void* ctx);
97 97
 
98
+/*
99
+ * RPC callback context.
100
+ *
101
+ * Defines a convenient way of packing an rpc callback
102
+ * (rpc_function_t) parameters and it's not used/needed
103
+ * by the rpc api/interface.
104
+ */
105
+typedef struct rpc_cb_ctx {
106
+	rpc_t *rpc;
107
+	void *c;
108
+} rpc_cb_ctx_t;
109
+
98 110
 
99 111
 /*
100 112
  * Remote Procedure Call Export
Browse code

core: rpc capabilities and delayed reply api

- added a new rpc function for interrogating the current rpc
transport capabilities (for now the only extra capability is
RPC_DELAYED_REPLY).
- added a new special delayed reply rpc context and rpc functions hooks for
creating and closing it.

Andrei Pelinescu-Onciul authored on 30/07/2009 13:40:42
Showing 1 changed files
... ...
@@ -37,7 +37,13 @@ enum rpc_flags {
37 37
 	RET_ARRAY = (1 << 0),
38 38
 	RET_VALUE = (1 << 1)
39 39
 };
40
-	
40
+
41
+typedef enum rpc_capabilities {
42
+	RPC_DELAYED_REPLY = (1 <<0)  /* delayed reply support */
43
+} rpc_capabilities_t;
44
+
45
+struct rpc_delayed_ctx;
46
+
41 47
 
42 48
 /* Send the result to the caller */
43 49
 typedef int (*rpc_send_f)(void* ctx);                                      /* Send the reply to the client */
... ...
@@ -49,6 +55,13 @@ typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Cr
49 55
 typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /* Scan attributes of a structure */
50 56
 typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct version of rpc_printf */
51 57
 
58
+/* returns the supported capabilities */
59
+typedef rpc_capabilities_t (*rpc_capabilities_f)(void* ctx);
60
+/* create a special "context" for delayed replies */
61
+typedef struct rpc_delayed_ctx* (*rpc_delayed_ctx_new_f)(void* ctx);
62
+/* close the special "context" for delayed replies */
63
+typedef void (*rpc_delayed_ctx_close_f)(struct rpc_delayed_ctx* dctx);
64
+
52 65
 /*
53 66
  * RPC context, this is what RPC functions get as a parameter and use
54 67
  * it to obtain the value of the parameters of the call and reference
... ...
@@ -63,9 +76,19 @@ typedef struct rpc {
63 76
 	rpc_struct_add_f struct_add;
64 77
 	rpc_struct_scan_f struct_scan;
65 78
 	rpc_struct_printf_f struct_printf;
79
+	rpc_capabilities_f capabilities;
80
+	rpc_delayed_ctx_new_f delayed_ctx_new;
81
+	rpc_delayed_ctx_close_f delayed_ctx_close;
66 82
 } rpc_t;
67 83
 
68 84
 
85
+typedef struct rpc_delayed_ctx{
86
+	rpc_t rpc;
87
+	void* reply_ctx;
88
+	/* more private data might follow */
89
+} rpc_delayed_ctx_t;
90
+
91
+
69 92
 /*
70 93
  * RPC Function Prototype
71 94
  */
Browse code

- struct_printf added

Jan Janak authored on 20/12/2005 11:39:05
Showing 1 changed files
... ...
@@ -40,13 +40,14 @@ enum rpc_flags {
40 40
 	
41 41
 
42 42
 /* Send the result to the caller */
43
-typedef int (*rpc_send_f)(void* ctx);                           /* Send the reply to the client */
44
-typedef void (*rpc_fault_f)(void* ctx, int code, char* reason); /* Signal a failure to the client */
45
-typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);            /* Add a new piece of data to the result */
46
-typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);           /* Retrieve request parameters */
47
-typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);         /* Add printf-like formated data to the result set */
48
-typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);     /* Create a new structure */
49
-typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);    /* Scan attributes of a structure */
43
+typedef int (*rpc_send_f)(void* ctx);                                      /* Send the reply to the client */
44
+typedef void (*rpc_fault_f)(void* ctx, int code, char* fmt, ...);          /* Signal a failure to the client */
45
+typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                       /* Add a new piece of data to the result */
46
+typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                      /* Retrieve request parameters */
47
+typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);                    /* Add printf-like formated data to the result set */
48
+typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);                /* Create a new structure */
49
+typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);               /* Scan attributes of a structure */
50
+typedef int (*rpc_struct_printf_f)(void* ctx, char* name, char* fmt, ...); /* Struct version of rpc_printf */
50 51
 
51 52
 /*
52 53
  * RPC context, this is what RPC functions get as a parameter and use
... ...
@@ -61,6 +62,7 @@ typedef struct rpc {
61 62
 	rpc_printf_f printf;
62 63
 	rpc_struct_add_f struct_add;
63 64
 	rpc_struct_scan_f struct_scan;
65
+	rpc_struct_printf_f struct_printf;
64 66
 } rpc_t;
65 67
 
66 68
 
Browse code

- slightly change function prototypes

Jan Janak authored on 15/12/2005 23:16:26
Showing 1 changed files
... ...
@@ -40,13 +40,13 @@ enum rpc_flags {
40 40
 	
41 41
 
42 42
 /* Send the result to the caller */
43
-typedef int (*rpc_send_f)(void* ctx);                              /* Send the reply to the client */
44
-typedef void (*rpc_fault_f)(void* ctx, int code, char* reason);          /* Signal a failure to the client */
45
-typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                     /* Add a new piece of data to the result */
46
-typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                    /* Retrieve request parameters */
47
-typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);                  /* Add printf-like formated data to the result set */
48
-typedef int (*rpc_struct_add_f)(int handle, char* fmt, ...);  /* Create a new structure */
49
-typedef int (*rpc_struct_scan_f)(int handle, char* fmt, ...); /* Scan attributes of a structure */
43
+typedef int (*rpc_send_f)(void* ctx);                           /* Send the reply to the client */
44
+typedef void (*rpc_fault_f)(void* ctx, int code, char* reason); /* Signal a failure to the client */
45
+typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);            /* Add a new piece of data to the result */
46
+typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);           /* Retrieve request parameters */
47
+typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);         /* Add printf-like formated data to the result set */
48
+typedef int (*rpc_struct_add_f)(void* ctx, char* fmt, ...);     /* Create a new structure */
49
+typedef int (*rpc_struct_scan_f)(void* ctx, char* fmt, ...);    /* Scan attributes of a structure */
50 50
 
51 51
 /*
52 52
  * RPC context, this is what RPC functions get as a parameter and use
Browse code

- new management interface

Jan Janak authored on 12/12/2005 23:40:42
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,85 @@
1
+/* $Id$
2
+ *
3
+ * SER Remote Procedure Call Interface
4
+ *
5
+ * Copyright (C) 2005 iptelorg GmbH
6
+ *
7
+ * This file is part of ser, a free SIP server.
8
+ *
9
+ * ser is free software; you can redistribute it and/or modify
10
+ * it under the terms of the GNU General Public License as published by
11
+ * the Free Software Foundation; either version 2 of the License, or
12
+ * (at your option) any later version
13
+ *
14
+ * For a license to use the ser software under conditions
15
+ * other than those described here, or to purchase support for this
16
+ * software, please contact iptel.org by e-mail at the following addresses:
17
+ *    info@iptel.org
18
+ *
19
+ * ser is distributed in the hope that it will be useful,
20
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
21
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22
+ * GNU General Public License for more details.
23
+ *
24
+ * You should have received a copy of the GNU General Public License 
25
+ * along with this program; if not, write to the Free Software 
26
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
27
+ */
28
+
29
+#ifndef _RPC_H
30
+#define _RPC_H
31
+
32
+/*
33
+ * TODO: Add the possibility to add printf-like formatted string to fault
34
+ */
35
+
36
+enum rpc_flags {
37
+	RET_ARRAY = (1 << 0),
38
+	RET_VALUE = (1 << 1)
39
+};
40
+	
41
+
42
+/* Send the result to the caller */
43
+typedef int (*rpc_send_f)(void* ctx);                              /* Send the reply to the client */
44
+typedef void (*rpc_fault_f)(void* ctx, int code, char* reason);          /* Signal a failure to the client */
45
+typedef int (*rpc_add_f)(void* ctx, char* fmt, ...);                     /* Add a new piece of data to the result */
46
+typedef int (*rpc_scan_f)(void* ctx, char* fmt, ...);                    /* Retrieve request parameters */
47
+typedef int (*rpc_printf_f)(void* ctx, char* fmt, ...);                  /* Add printf-like formated data to the result set */
48
+typedef int (*rpc_struct_add_f)(int handle, char* fmt, ...);  /* Create a new structure */
49
+typedef int (*rpc_struct_scan_f)(int handle, char* fmt, ...); /* Scan attributes of a structure */
50
+
51
+/*
52
+ * RPC context, this is what RPC functions get as a parameter and use
53
+ * it to obtain the value of the parameters of the call and reference
54
+ * to the result structure that will be returned to the caller
55
+ */
56
+typedef struct rpc {
57
+	rpc_fault_f fault;
58
+	rpc_send_f send;
59
+	rpc_add_f add;
60
+	rpc_scan_f scan;
61
+	rpc_printf_f printf;
62
+	rpc_struct_add_f struct_add;
63
+	rpc_struct_scan_f struct_scan;
64
+} rpc_t;
65
+
66
+
67
+/*
68
+ * RPC Function Prototype
69
+ */
70
+
71
+typedef void (*rpc_function_t)(rpc_t* rpc, void* ctx);
72
+
73
+
74
+/*
75
+ * Remote Procedure Call Export
76
+ */
77
+typedef struct rpc_export {
78
+	const char* name;        /* Name of the RPC function (null terminated) */
79
+	rpc_function_t function; /* Pointer to the function */
80
+	const char** doc_str;  /* Documentation strings, method signature and description */
81
+	unsigned int flags;      /* Various flags, reserved for future use */
82
+} rpc_export_t;
83
+
84
+
85
+#endif /* _RPC_H */