Module: sip-router
Branch: andrei/raw_sock
Commit: 27e652b7ed5ef3bccfb92d2653831a1afe37993e
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=27e652b…
Author: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei(a)iptel.org>
Date: Wed Aug 11 16:02:10 2010 +0200
raw sockets: added info rpc
Added core.udp4_raw_info RPC for getting information about the raw
mode state.
E.g.:
sercmd> core.udp4_raw_info
{
udp4_raw: 1
udp4_raw_mtu: 1500
udp4_raw_ttl: 64
}
---
core_cmd.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/core_cmd.c b/core_cmd.c
index 75d4e72..292e16f 100644
--- a/core_cmd.c
+++ b/core_cmd.c
@@ -44,6 +44,7 @@
#include "tcp_info.h"
#include "tcp_options.h"
#include "core_cmd.h"
+#include "cfg_core.h"
#ifdef USE_SCTP
#include "sctp_options.h"
#include "sctp_server.h"
@@ -807,6 +808,30 @@ static void core_sctpinfo(rpc_t* rpc, void* c)
+
+static const char* core_udp4rawinfo_doc[] = {
+ "Returns udp4_raw related info.", /* Documentation string */
+ 0 /* Method signature(s) */
+};
+
+static void core_udp4rawinfo(rpc_t* rpc, void* c)
+{
+#ifdef USE_RAW_SOCKS
+ void *handle;
+
+ rpc->add(c, "{", &handle);
+ rpc->struct_add(handle, "ddd",
+ "udp4_raw", cfg_get(core, core_cfg, udp4_raw),
+ "udp4_raw_mtu", cfg_get(core, core_cfg, udp4_raw_mtu),
+ "udp4_raw_ttl", cfg_get(core, core_cfg, udp4_raw_ttl)
+ );
+#else /* USE_RAW_SOCKS */
+ rpc->fault(c, 500, "udp4_raw mode support not compiled");
+#endif /* USE_RAW_SOCKS */
+}
+
+
+
/*
* RPC Methods exported by this module
*/
@@ -835,6 +860,8 @@ static rpc_export_t core_rpc_methods[] = {
{"core.sctp_options", core_sctp_options, core_sctp_options_doc,
0},
{"core.sctp_info", core_sctpinfo, core_sctpinfo_doc, 0},
+ {"core.udp4_raw_info", core_udp4rawinfo, core_udp4rawinfo_doc,
+ 0},
#ifdef USE_DNS_CACHE
{"dns.mem_info", dns_cache_mem_info, dns_cache_mem_info_doc,
0 },