2
0
Эх сурвалжийг харах

- new configuration option server_id added, this option can be used to
discriminate servers within a cluster, to be used by modules like
acc_db and usrloc

Jan Janak 17 жил өмнө
parent
commit
89fde57534
5 өөрчлөгдсөн 13 нэмэгдсэн , 0 устгасан
  1. 4 0
      NEWS
  2. 3 0
      cfg.lex
  3. 2 0
      cfg.y
  4. 2 0
      globals.h
  5. 2 0
      main.c

+ 4 - 0
NEWS

@@ -138,6 +138,10 @@ core:
                between the short name and long name in cache as CNAME record
 
 new config variables:
+  server_id = number - A configurable unique server id that can be used to
+                       discriminate server instances within a cluster of
+                       servers when all other information, such as IP adddresses
+                       are same.
   loadpath = <modules path> - directory where to load the modules from (-L
      equivalent); modules can be loaded simply by specifying their name
      (loadmodule "maxfwd")

+ 3 - 0
cfg.lex

@@ -343,6 +343,8 @@ STUN_REFRESH_INTERVAL "stun_refresh_interval"
 STUN_ALLOW_STUN "stun_allow_stun"
 STUN_ALLOW_FP "stun_allow_fp"
 
+SERVER_ID     "server_id"
+
 CFG_DESCRIPTION		"description"|"descr"|"desc"
 
 LOADMODULE	loadmodule
@@ -652,6 +654,7 @@ EAT_ABLE	[\ \t\b\r]
 									return PMTU_DISCOVERY; }
 <INITIAL>{KILL_TIMEOUT}			{	count(); yylval.strval=yytext;
 									return KILL_TIMEOUT; }
+<INITIAL>{SERVER_ID}  { count(); yylval.strval=yytext; return SERVER_ID;}
 <INITIAL>{CFG_DESCRIPTION}	{ count(); yylval.strval=yytext; return CFG_DESCRIPTION; }
 <INITIAL>{LOADMODULE}	{ count(); yylval.strval=yytext; return LOADMODULE; }
 <INITIAL>{LOADPATH}		{ count(); yylval.strval=yytext; return LOADPATH; }

+ 2 - 0
cfg.y

@@ -386,6 +386,7 @@ static struct socket_id* mk_listen_id(char*, int, int);
 %token PMTU_DISCOVERY
 %token KILL_TIMEOUT
 %token CFG_DESCRIPTION
+%token SERVER_ID
 
 %token FLAGS_DECL
 %token AVPFLAGS_DECL
@@ -1112,6 +1113,7 @@ assign_stm:
 	| STUN_ALLOW_STUN EQUAL error{ yyerror("number expected"); }
 	| STUN_ALLOW_FP EQUAL NUMBER { IF_STUN(stun_allow_fp=$3) ; }
 	| STUN_ALLOW_FP EQUAL error{ yyerror("number expected"); }
+    | SERVER_ID EQUAL NUMBER { server_id=$3; }
 	| cfg_var
 	| error EQUAL { yyerror("unknown config variable"); }
 	;

+ 2 - 0
globals.h

@@ -56,6 +56,8 @@ extern char* pid_file;
 extern char* pgid_file;
 extern int own_pgid; /* whether or not we have our own pgid (and it's ok to use kill(0, sig) */
 
+extern int server_id; /* A unique ID of the SIP server */
+
 extern struct socket_info* bind_address; /* pointer to the crt. proc.
 											listening address */
 extern struct socket_info* sendipv4; /* ipv4 socket to use when msg.

+ 2 - 0
main.c

@@ -339,6 +339,8 @@ int sock_uid= -1;
 int sock_gid= -1;
 int sock_mode= S_IRUSR| S_IWUSR| S_IRGRP| S_IWGRP; /* rw-rw---- */
 
+int server_id = 0; /* Configurable unique ID of the server */
+
 /* more config stuff */
 int disable_core_dump=0; /* by default enabled */
 int open_files_limit=-1; /* don't touch it by default */