diff -durN old/python_iface.c new/python_iface.c
--- old/python_iface.c	2012-12-04 18:14:32.000000000 +0200
+++ new/python_iface.c	2012-12-04 19:08:39.000000000 +0200
@@ -26,7 +26,7 @@
 #include "../../dprint.h"
 #include "../../route_struct.h"
 #include "python_exec.h"
-
+#include "../../sr_module.h"
 
 /*
  * Python method: LM_GEN1(self, int log_level, str msg)
@@ -214,5 +214,24 @@
     * Reference: dprint.h
     */
     PyModule_AddObject(m, "DEFAULT_FACILITY", PyInt_FromLong((long)DEFAULT_FACILITY));
+
+
+    /*
+    * Ranks. Used as rank in child_init function
+    * Reference: sr_module.h
+    */
+    PyModule_AddObject(m, "PROC_MAIN",		PyInt_FromLong((long)PROC_MAIN));		
+    PyModule_AddObject(m, "PROC_TIMER",		PyInt_FromLong((long)PROC_TIMER));
+    PyModule_AddObject(m, "PROC_RPC",		PyInt_FromLong((long)PROC_RPC));
+    PyModule_AddObject(m, "PROC_FIFO",		PyInt_FromLong((long)PROC_FIFO));
+    PyModule_AddObject(m, "PROC_TCP_MAIN",	PyInt_FromLong((long)PROC_TCP_MAIN));
+    PyModule_AddObject(m, "PROC_UNIXSOCK",	PyInt_FromLong((long)PROC_UNIXSOCK));
+    PyModule_AddObject(m, "PROC_ATTENDANT",	PyInt_FromLong((long)PROC_ATTENDANT));
+    PyModule_AddObject(m, "PROC_INIT",		PyInt_FromLong((long)PROC_INIT));
+    PyModule_AddObject(m, "PROC_NOCHLDINIT",	PyInt_FromLong((long)PROC_NOCHLDINIT));
+    PyModule_AddObject(m, "PROC_SIPINIT",	PyInt_FromLong((long)PROC_SIPINIT));
+    PyModule_AddObject(m, "PROC_SIPRPC",	PyInt_FromLong((long)PROC_SIPRPC));
+    PyModule_AddObject(m, "PROC_MIN",		PyInt_FromLong((long)PROC_MIN));
+
 }
 
diff -durN old/TestCase_Ranks.py new/TestCase_Ranks.py
--- old/TestCase_Ranks.py	1970-01-01 03:00:00.000000000 +0300
+++ new/TestCase_Ranks.py	2012-12-04 19:10:03.000000000 +0200
@@ -0,0 +1,82 @@
+# -*- coding: utf-8 -*-
+
+"""
+    Script for rank tests.
+    2012.12.04: Created by: Konstantin M. <evilzluk@gmail.com>
+"""
+
+import Router
+
+"""
+    Module Properties:
+       Ranks:
+           PROC_MAIN		- Main ser process
+           PROC_TIMER		- Timer attendant process
+           PROC_RPC		- RPC type process
+           PROC_FIFO		- FIFO attendant process
+           PROC_TCP_MAIN	- TCP main process
+           PROC_UNIXSOCK	- Unix socket server
+           PROC_ATTENDANT	- main "attendant" process
+           PROC_INIT		- special rank, the context is the main ser
+                                    process, but this is guaranteed to be executed
+                                    before any process is forked, so it can be used
+                                    to setup shared variables that depend on some
+                                    after mod_init available information (e.g.
+                                    total number of processes).
+
+                                    @warning child_init(PROC_MAIN) is again called
+				    in the same process (main), but latter
+                                    (before tcp), so make sure you don't init things
+                                    twice, bot in PROC_MAIN and PROC_INT
+
+           PROC_NOCHLDINIT	- no child init functions will be called if this rank is used in fork_process()
+           PROC_SIPINIT		- First SIP worker - some modules do special processing in this child, like loading db data
+           PROC_SIPRPC		- Used to init RPC worker as SIP commands handler. Don't do any special processing in the
+				    child init with this rank - just bare child initialization
+	   PROC_MIN		- Minimum process rank
+
+
+"""
+
+class Ranks:
+
+    def __init__(self):
+	pass
+
+    def __del__(self):
+	pass
+
+    def child_init(self, rank):
+
+	if rank == Router.PROC_MAIN:
+	    rank_name = "PROC_MAIN"
+	elif rank == Router.PROC_TIMER:
+	     rank_name = "PROC_TIMER"
+	elif rank == Router.PROC_RPC:
+	     rank_name = "PROC_RPC"
+	elif rank == Router.PROC_FIFO:
+	     rank_name = "PROC_FIFO"
+	elif rank == Router.PROC_TCP_MAIN:
+	     rank_name = "PROC_TCP_MAIN"
+	elif rank == Router.PROC_UNIXSOCK:
+	     rank_name = "PROC_UNIXSOCK"
+	elif rank == Router.PROC_ATTENDANT:
+	     rank_name = "PROC_ATTENDANT"
+	elif rank == Router.PROC_INIT:
+	     rank_name = "PROC_INIT"
+	elif rank == Router.PROC_NOCHLDINIT:
+	     rank_name = "PROC_NOCHLDINIT"
+	elif rank == Router.PROC_SIPINIT:
+	     rank_name = "PROC_SIPINIT"
+	elif rank == Router.PROC_SIPRPC:
+	     rank_name = "PROC_SIPRPC"
+	else:
+	    rank_name = "UNKNOWN"
+
+	Router.LM_INFO("Rank: %d (%s)\n" % (rank, rank_name))
+
+	return 0
+
+def mod_init():
+    return Ranks()
+
