Module: sip-router Branch: master Commit: 81a14eb9d3f7f93b5171db016fd9b7a16647e8e3 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=81a14eb9...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Daniel-Constantin Mierla miconda@gmail.com Date: Mon Jul 11 13:14:29 2011 +0200
ndb_redis: added module documentation
---
modules/ndb_redis/README | 130 +++++++++++++++++++++++++++++ modules/ndb_redis/doc/Makefile | 4 + modules/ndb_redis/doc/ndb_redis.xml | 37 ++++++++ modules/ndb_redis/doc/ndb_redis_admin.xml | 127 ++++++++++++++++++++++++++++ 4 files changed, 298 insertions(+), 0 deletions(-)
diff --git a/modules/ndb_redis/README b/modules/ndb_redis/README new file mode 100644 index 0000000..37409c4 --- /dev/null +++ b/modules/ndb_redis/README @@ -0,0 +1,130 @@ +NDB_REDIS Module + +Daniel-Constantin Mierla + + miconda@gmail.com + +Edited by + +Daniel-Constantin Mierla + + miconda@gmail.com + + Copyright © 2011 asipto.com + __________________________________________________________________ + + Table of Contents + + 1. Admin Guide + + 1. Overview + 2. Dependencies + + 2.1. Kamailio Modules + 2.2. External Libraries or Applications + + 3. Exported Parameters + + 3.1. server (int) + + 4. Exported Functions + + 4.1. redis_cmd(srvname, command, replyid) + + List of Examples + + 1.1. Set server parameter + 1.2. redis_cmd usage + +Chapter 1. Admin Guide + + Table of Contents + + 1. Overview + 2. Dependencies + + 2.1. Kamailio Modules + 2.2. External Libraries or Applications + + 3. Exported Parameters + + 3.1. server (int) + + 4. Exported Functions + + 4.1. redis_cmd(srvname, command, replyid) + +1. Overview + + This module provides a connector to interact with REDIS NoSQL Database + from configuration file. You can read more about REDIS at + http://redis.io. + + It can connect to many REDIS servers and store the results in different + containers. + +2. Dependencies + + 2.1. Kamailio Modules + 2.2. External Libraries or Applications + +2.1. Kamailio Modules + + The following modules must be loaded before this module: + * none. + +2.2. External Libraries or Applications + + The following libraries or applications must be installed before + running Kamailio with this module loaded: + * hiredis - available at https://github.com/antirez/hiredis . + +3. Exported Parameters + + 3.1. server (int) + +3.1. server (int) + + Specify the details to connect to REDIS server. It takes a list of + attribute=value separated by semicolon, the attributes can be name, + addr and port. Name is a genric identifier to be used with module + functions. addr and port are the IP address and the port to connect to + REDIS server. + + Default value is NULL. + + Example 1.1. Set server parameter +... +modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379") +... + +4. Exported Functions + + 4.1. redis_cmd(srvname, command, replyid) + +4.1. redis_cmd(srvname, command, replyid) + + Send a command to REDIS server identified by srvname. The reply will be + stored in a local continer identified by replyid. All the parameters + can be strings with pseudo-variables that are evaluated at runtime. + + The reply can be accessed via pseudo-variable $redis(key). The key can + be: type - type of the reply (as in hiredis.h); value - the value + returned by REDIS server; info - in case of error from REDIS, it will + contain an info message. + + Example 1.2. redis_cmd usage +... +if(redis_cmd("srvN", "INCR cnt", "r")) { + # success - the incremented value is in $redis(r=>value) + xlog("===== $redis(r=>type) * $redis(r=>value)\n"); +} + +# set a value +redis_cmd("srvN", "SET foo bar", "r"); + +redis_cmd("srvN", "SET ruri $ru", "r"); + +# get a value +redis_cmd("srvN", "GET foo", "r"); +... diff --git a/modules/ndb_redis/doc/Makefile b/modules/ndb_redis/doc/Makefile new file mode 100644 index 0000000..04540cb --- /dev/null +++ b/modules/ndb_redis/doc/Makefile @@ -0,0 +1,4 @@ +docs = ndb_redis.xml + +docbook_dir = ../../../docbook +include $(docbook_dir)/Makefile.module diff --git a/modules/ndb_redis/doc/ndb_redis.xml b/modules/ndb_redis/doc/ndb_redis.xml new file mode 100644 index 0000000..f9caa15 --- /dev/null +++ b/modules/ndb_redis/doc/ndb_redis.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding='ISO-8859-1'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" +"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ + +<!-- Include general documentation entities --> +<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml"> +%docentities; + +]> + +<book xmlns:xi="http://www.w3.org/2001/XInclude"> + <bookinfo> + <title>NDB_REDIS Module</title> + <productname class="trade">sip-router.org</productname> + <authorgroup> + <author> + <firstname>Daniel-Constantin</firstname> + <surname>Mierla</surname> + <email>miconda@gmail.com</email> + </author> + <editor> + <firstname>Daniel-Constantin</firstname> + <surname>Mierla</surname> + <email>miconda@gmail.com</email> + </editor> + </authorgroup> + <copyright> + <year>2011</year> + <holder>asipto.com</holder> + </copyright> + </bookinfo> + <toc></toc> + + <xi:include href="ndb_redis_admin.xml"/> + + +</book> diff --git a/modules/ndb_redis/doc/ndb_redis_admin.xml b/modules/ndb_redis/doc/ndb_redis_admin.xml new file mode 100644 index 0000000..a9609a2 --- /dev/null +++ b/modules/ndb_redis/doc/ndb_redis_admin.xml @@ -0,0 +1,127 @@ +<?xml version="1.0" encoding='ISO-8859-1'?> +<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN" +"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [ + +<!-- Include general documentation entities --> +<!ENTITY % docentities SYSTEM "../../../docbook/entities.xml"> +%docentities; + +]> +<!-- Module User's Guide --> + +<chapter> + + <title>&adminguide;</title> + + <section> + <title>Overview</title> + <para> + This module provides a connector to interact with REDIS NoSQL Database + from configuration file. You can read more about REDIS at + http://redis.io. + </para> + <para> + It can connect to many REDIS servers and store the results in different + containers. + </para> + </section> + + <section> + <title>Dependencies</title> + <section> + <title>&kamailio; Modules</title> + <para> + The following modules must be loaded before this module: + <itemizedlist> + <listitem> + <para> + <emphasis>none</emphasis>. + </para> + </listitem> + </itemizedlist> + </para> + </section> + <section> + <title>External Libraries or Applications</title> + <para> + The following libraries or applications must be installed before running + &kamailio; with this module loaded: + <itemizedlist> + <listitem> + <para> + <emphasis>hiredis</emphasis> - available at + https://github.com/antirez/hiredis . + </para> + </listitem> + </itemizedlist> + </para> + </section> + </section> + <section> + <title>Exported Parameters</title> + <section> + <title><varname>server</varname> (int)</title> + <para> + Specify the details to connect to REDIS server. It takes a list of + attribute=value separated by semicolon, the attributes can be + name, addr and port. Name is a genric identifier to be used with + module functions. addr and port are the IP address and the port to + connect to REDIS server. + </para> + <para> + <emphasis> + Default value is NULL. + </emphasis> + </para> + <example> + <title>Set <varname>server</varname> parameter</title> + <programlisting format="linespecific"> +... +modparam("ndb_redis", "server", "name=srvN;addr=127.0.0.1;port=6379") +... +</programlisting> + </example> + </section> + </section> + + <section> + <title>Exported Functions</title> + <section> + <title> + <function moreinfo="none">redis_cmd(srvname, command, replyid)</function> + </title> + <para> + Send a command to REDIS server identified by srvname. The reply will + be stored in a local continer identified by replyid. All the + parameters can be strings with pseudo-variables that are evaluated + at runtime. + </para> + <para> + The reply can be accessed via pseudo-variable $redis(key). The key + can be: type - type of the reply (as in hiredis.h); value - the value + returned by REDIS server; info - in case of error from REDIS, it will + contain an info message. + </para> + <example> + <title><function>redis_cmd</function> usage</title> + <programlisting format="linespecific"> +... +if(redis_cmd("srvN", "INCR cnt", "r")) { + # success - the incremented value is in $redis(r=>value) + xlog("===== $redis(r=>type) * $redis(r=>value)\n"); +} + +# set a value +redis_cmd("srvN", "SET foo bar", "r"); + +redis_cmd("srvN", "SET ruri $ru", "r"); + +# get a value +redis_cmd("srvN", "GET foo", "r"); +... +</programlisting> + </example> + </section> + </section> +</chapter> +