Mercurial > hg > freeDiameter
comparison freeDiameter/fdd.y @ 10:c5c99c73c2bf
Added some extensions and functions in the daemon
author | Sebastien Decugis <sdecugis@nict.go.jp> |
---|---|
date | Fri, 25 Sep 2009 16:12:08 +0900 |
parents | 3e143f047f78 |
children | 418d2ce80dc8 |
comparison
equal
deleted
inserted
replaced
9:fc7c18867cf7 | 10:c5c99c73c2bf |
---|---|
60 | 60 |
61 /* Function to report error */ | 61 /* Function to report error */ |
62 void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s) | 62 void yyerror (YYLTYPE *ploc, struct fd_config * conf, char const *s) |
63 { | 63 { |
64 if (ploc->first_line != ploc->last_line) | 64 if (ploc->first_line != ploc->last_line) |
65 fprintf(stderr, "%s:%d.%d-%d.%d : %s\n", conf->conf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s); | 65 fprintf(stderr, "%s:%d.%d-%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_line, ploc->last_column, s); |
66 else if (ploc->first_column != ploc->last_column) | 66 else if (ploc->first_column != ploc->last_column) |
67 fprintf(stderr, "%s:%d.%d-%d : %s\n", conf->conf_file, ploc->first_line, ploc->first_column, ploc->last_column, s); | 67 fprintf(stderr, "%s:%d.%d-%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, ploc->last_column, s); |
68 else | 68 else |
69 fprintf(stderr, "%s:%d.%d : %s\n", conf->conf_file, ploc->first_line, ploc->first_column, s); | 69 fprintf(stderr, "%s:%d.%d : %s\n", conf->cnf_file, ploc->first_line, ploc->first_column, s); |
70 } | 70 } |
71 | 71 |
72 %} | 72 %} |
73 | 73 |
74 /* Values returned by lex for token */ | 74 /* Values returned by lex for token */ |
108 | 108 |
109 /* The grammar definition - Sections blocs. */ | 109 /* The grammar definition - Sections blocs. */ |
110 conffile: /* Empty is OK */ | 110 conffile: /* Empty is OK */ |
111 | conffile localidentity | 111 | conffile localidentity |
112 | conffile localrealm | 112 | conffile localrealm |
113 | conffile tctimer | |
114 | conffile twtimer | |
113 | conffile localport | 115 | conffile localport |
114 | conffile localsecport | 116 | conffile localsecport |
117 | conffile sctpstreams | |
118 | conffile listenon | |
119 | conffile norelay | |
115 | conffile noip | 120 | conffile noip |
116 | conffile noip6 | 121 | conffile noip6 |
117 | conffile notcp | 122 | conffile notcp |
118 | conffile nosctp | 123 | conffile nosctp |
119 | conffile prefertcp | 124 | conffile prefertcp |
120 | conffile oldtls | 125 | conffile oldtls |
121 | conffile sctpstreams | |
122 | conffile listenon | |
123 | conffile tctimer | |
124 | conffile twtimer | |
125 | conffile norelay | |
126 | conffile loadext | 126 | conffile loadext |
127 ; | 127 ; |
128 | 128 |
129 localidentity: LOCALIDENTITY '=' QSTRING ';' | 129 localidentity: LOCALIDENTITY '=' QSTRING ';' |
130 { | 130 { |
131 conf->diam_id = $3; | 131 conf->cnf_diamid = $3; |
132 } | 132 } |
133 ; | 133 ; |
134 | 134 |
135 localrealm: LOCALREALM '=' QSTRING ';' | 135 localrealm: LOCALREALM '=' QSTRING ';' |
136 { | 136 { |
137 conf->diam_realm = $3; | 137 conf->cnf_diamrlm = $3; |
138 } | |
139 ; | |
140 | |
141 tctimer: TCTIMER '=' INTEGER ';' | |
142 { | |
143 CHECK_PARAMS_DO( ($3 > 0), | |
144 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | |
145 conf->cnf_timer_tc = (unsigned int)$3; | |
146 } | |
147 ; | |
148 | |
149 twtimer: TWTIMER '=' INTEGER ';' | |
150 { | |
151 CHECK_PARAMS_DO( ($3 > 5), | |
152 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | |
153 conf->cnf_timer_tw = (unsigned int)$3; | |
138 } | 154 } |
139 ; | 155 ; |
140 | 156 |
141 localport: LOCALPORT '=' INTEGER ';' | 157 localport: LOCALPORT '=' INTEGER ';' |
142 { | 158 { |
143 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), | 159 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), |
144 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | 160 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); |
145 conf->loc_port = (uint16_t)$3; | 161 conf->cnf_port = (uint16_t)$3; |
146 } | 162 } |
147 ; | 163 ; |
148 | 164 |
149 localsecport: LOCALSECPORT '=' INTEGER ';' | 165 localsecport: LOCALSECPORT '=' INTEGER ';' |
150 { | 166 { |
151 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), | 167 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), |
152 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | 168 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); |
153 conf->loc_port_tls = (uint16_t)$3; | 169 conf->cnf_port_tls = (uint16_t)$3; |
154 } | |
155 ; | |
156 | |
157 noip: NOIP ';' | |
158 { | |
159 conf->flags.no_ip4 = 1; | |
160 } | |
161 ; | |
162 | |
163 noip6: NOIP6 ';' | |
164 { | |
165 conf->flags.no_ip6 = 1; | |
166 } | |
167 ; | |
168 | |
169 notcp: NOTCP ';' | |
170 { | |
171 conf->flags.no_tcp = 1; | |
172 } | |
173 ; | |
174 | |
175 nosctp: NOSCTP ';' | |
176 { | |
177 conf->flags.no_sctp = 1; | |
178 } | |
179 ; | |
180 | |
181 prefertcp: PREFERTCP ';' | |
182 { | |
183 conf->flags.pr_tcp = 1; | |
184 } | |
185 ; | |
186 | |
187 oldtls: OLDTLS ';' | |
188 { | |
189 conf->flags.tls_alg = 1; | |
190 } | 170 } |
191 ; | 171 ; |
192 | 172 |
193 sctpstreams: SCTPSTREAMS '=' INTEGER ';' | 173 sctpstreams: SCTPSTREAMS '=' INTEGER ';' |
194 { | 174 { |
195 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), | 175 CHECK_PARAMS_DO( ($3 > 0) && ($3 < 1<<16), |
196 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | 176 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); |
197 conf->loc_sctp_str = (uint16_t)$3; | 177 conf->cnf_sctp_str = (uint16_t)$3; |
198 } | 178 } |
199 ; | 179 ; |
200 | 180 |
201 listenon: LISTENON '=' QSTRING ';' | 181 listenon: LISTENON '=' QSTRING ';' |
202 { | 182 { |
215 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; } | 195 if (ret) { yyerror (&yylloc, conf, gai_strerror(ret)); YYERROR; } |
216 | 196 |
217 memcpy(&ep->ss, ai->ai_addr, ai->ai_addrlen); | 197 memcpy(&ep->ss, ai->ai_addr, ai->ai_addrlen); |
218 free($3); | 198 free($3); |
219 freeaddrinfo(ai); | 199 freeaddrinfo(ai); |
220 fd_list_insert_before(&conf->loc_endpoints, &ep->chain); | 200 fd_list_insert_before(&conf->cnf_endpoints, &ep->chain); |
221 } | |
222 ; | |
223 | |
224 tctimer: TCTIMER '=' INTEGER ';' | |
225 { | |
226 CHECK_PARAMS_DO( ($3 > 0), | |
227 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | |
228 conf->timer_tc = (unsigned int)$3; | |
229 } | |
230 ; | |
231 | |
232 twtimer: TWTIMER '=' INTEGER ';' | |
233 { | |
234 CHECK_PARAMS_DO( ($3 > 5), | |
235 { yyerror (&yylloc, conf, "Invalid value"); YYERROR; } ); | |
236 conf->timer_tw = (unsigned int)$3; | |
237 } | 201 } |
238 ; | 202 ; |
239 | 203 |
240 norelay: NORELAY ';' | 204 norelay: NORELAY ';' |
241 { | 205 { |
242 conf->flags.no_fwd = 1; | 206 conf->cnf_flags.no_fwd = 1; |
207 } | |
208 ; | |
209 | |
210 noip: NOIP ';' | |
211 { | |
212 conf->cnf_flags.no_ip4 = 1; | |
213 } | |
214 ; | |
215 | |
216 noip6: NOIP6 ';' | |
217 { | |
218 conf->cnf_flags.no_ip6 = 1; | |
219 } | |
220 ; | |
221 | |
222 notcp: NOTCP ';' | |
223 { | |
224 conf->cnf_flags.no_tcp = 1; | |
225 } | |
226 ; | |
227 | |
228 nosctp: NOSCTP ';' | |
229 { | |
230 conf->cnf_flags.no_sctp = 1; | |
231 } | |
232 ; | |
233 | |
234 prefertcp: PREFERTCP ';' | |
235 { | |
236 conf->cnf_flags.pr_tcp = 1; | |
237 } | |
238 ; | |
239 | |
240 oldtls: OLDTLS ';' | |
241 { | |
242 conf->cnf_flags.tls_alg = 1; | |
243 } | 243 } |
244 ; | 244 ; |
245 | 245 |
246 loadext: LOADEXT '=' QSTRING extconf ';' | 246 loadext: LOADEXT '=' QSTRING extconf ';' |
247 { | 247 { |