Mercurial > hg > freeDiameter
comparison extensions/app_acct/acct_conf.y @ 528:1b3b9790e7cb
Add a new field in the app_acct.fdx database to receive the name of the local server.
Update your existing tables with the following SQL command:
ALTER TABLE "incoming" ADD "recorded_serv" bytea NOT NULL;
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 03 Sep 2010 16:46:16 +0900 |
parents | 26aafbbc1640 |
children | 4a9f08d6b6ba |
comparison
equal
deleted
inserted
replaced
527:e27cb71abd4b | 528:1b3b9790e7cb |
---|---|
99 fd_log_debug("[app_acct] Configuration dump:\n"); | 99 fd_log_debug("[app_acct] Configuration dump:\n"); |
100 fd_log_debug(" Database:\n"); | 100 fd_log_debug(" Database:\n"); |
101 fd_log_debug(" ConnInfo ...... : '%s'\n", acct_config->conninfo ?: "<null>"); | 101 fd_log_debug(" ConnInfo ...... : '%s'\n", acct_config->conninfo ?: "<null>"); |
102 fd_log_debug(" Table name .... : '%s'\n", acct_config->tablename ?: "<null>"); | 102 fd_log_debug(" Table name .... : '%s'\n", acct_config->tablename ?: "<null>"); |
103 fd_log_debug(" Timestamp field : '%s'\n", acct_config->tsfield ?: "<null>"); | 103 fd_log_debug(" Timestamp field : '%s'\n", acct_config->tsfield ?: "<null>"); |
104 fd_log_debug(" Server name fld : '%s'\n", acct_config->srvnfield ?: "<null>"); | |
104 fd_log_debug(" AVPs that will be saved to the database:\n"); | 105 fd_log_debug(" AVPs that will be saved to the database:\n"); |
105 for (li = acct_config->avps.next; li != &acct_config->avps; li = li->next) { | 106 for (li = acct_config->avps.next; li != &acct_config->avps; li = li->next) { |
106 struct acct_conf_avp * a = (struct acct_conf_avp *)li; | 107 struct acct_conf_avp * a = (struct acct_conf_avp *)li; |
107 fd_log_debug(" %-*s AVP%s saved in ", 30, a->avpname, a->required ? " [required]":"" ); | 108 fd_log_debug(" %-*s AVP%s saved in ", 30, a->avpname, a->required ? " [required]":"" ); |
108 if (a->multi) { | 109 if (a->multi) { |
134 | 135 |
135 /* destroy other data */ | 136 /* destroy other data */ |
136 free(acct_config->conninfo); | 137 free(acct_config->conninfo); |
137 free(acct_config->tablename); | 138 free(acct_config->tablename); |
138 free(acct_config->tsfield); | 139 free(acct_config->tsfield); |
140 free(acct_config->srvnfield); | |
139 | 141 |
140 /* Done */ | 142 /* Done */ |
141 free(acct_config); | 143 free(acct_config); |
142 acct_config = NULL; | 144 acct_config = NULL; |
143 } | 145 } |
202 %token REQUIRED | 204 %token REQUIRED |
203 %token MULTI | 205 %token MULTI |
204 %token CONNINFO | 206 %token CONNINFO |
205 %token TABLE | 207 %token TABLE |
206 %token TSFIELD | 208 %token TSFIELD |
209 %token SRVNFIELD | |
207 | 210 |
208 /* Tokens and types */ | 211 /* Tokens and types */ |
209 /* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */ | 212 /* A (de)quoted string (malloc'd in lex parser; it must be freed after use) */ |
210 %token <string> QSTRING | 213 %token <string> QSTRING |
211 | 214 |
221 conffile: /* empty grammar is OK for the parser (will be validated afterwards) */ | 224 conffile: /* empty grammar is OK for the parser (will be validated afterwards) */ |
222 | conffile avpline | 225 | conffile avpline |
223 | conffile conninfoline | 226 | conffile conninfoline |
224 | conffile tableline | 227 | conffile tableline |
225 | conffile tsfieldline | 228 | conffile tsfieldline |
229 | conffile srvnfieldline | |
226 | conffile errors | 230 | conffile errors |
227 { | 231 { |
228 yyerror(&yylloc, conffile, "An error occurred while parsing the configuration file."); | 232 yyerror(&yylloc, conffile, "An error occurred while parsing the configuration file."); |
229 return EINVAL; | 233 return EINVAL; |
230 } | 234 } |
318 YYERROR; | 322 YYERROR; |
319 } | 323 } |
320 acct_config->tsfield = $3 | 324 acct_config->tsfield = $3 |
321 } | 325 } |
322 ; | 326 ; |
327 | |
328 srvnfieldline: SRVNFIELD '=' QSTRING ';' | |
329 { | |
330 if (acct_config->srvnfield) { | |
331 yyerror (&yylloc, conffile, "Duplicate entry"); | |
332 YYERROR; | |
333 } | |
334 acct_config->srvnfield = $3 | |
335 } | |
336 ; |