Browse code

drouting: added dr_ prefix to internal time recurrence functions

- avoids symbol conflicts with the core tmrec.c
- GH #2828

(cherry picked from commit 33ea38f35f9911a26a757dbfa22065eb80a9a24a)
(cherry picked from commit b49f23af03d5e2f0364610739e7ef6e07cfd54a5)

Daniel-Constantin Mierla authored on 18/08/2021 15:39:25
Showing 7 changed files
... ...
@@ -173,35 +173,35 @@ static void free_tmp_gw_list(void)
173 173
 }
174 174
 
175 175
 
176
-static inline tmrec_t *parse_time_def(char *time_str)
176
+static inline dr_tmrec_t *parse_time_def(char *time_str)
177 177
 {
178
-	tmrec_t *time_rec;
178
+	dr_tmrec_t *time_rec;
179 179
 	char *p, *s;
180 180
 
181 181
 	p = time_str;
182 182
 	time_rec = 0;
183 183
 
184
-	time_rec = (tmrec_t *)shm_malloc(sizeof(tmrec_t));
184
+	time_rec = (dr_tmrec_t *)shm_malloc(sizeof(dr_tmrec_t));
185 185
 	if(time_rec == 0) {
186 186
 		LM_ERR("no more pkg mem\n");
187 187
 		goto error;
188 188
 	}
189
-	memset(time_rec, 0, sizeof(tmrec_t));
189
+	memset(time_rec, 0, sizeof(dr_tmrec_t));
190 190
 
191 191
 	/* empty definition? */
192 192
 	if(time_str == 0 || *time_str == 0)
193 193
 		goto done;
194 194
 
195
-	load_TR_value(p, s, time_rec, tr_parse_dtstart, parse_error, done);
196
-	load_TR_value(p, s, time_rec, tr_parse_duration, parse_error, done);
197
-	load_TR_value(p, s, time_rec, tr_parse_freq, parse_error, done);
198
-	load_TR_value(p, s, time_rec, tr_parse_until, parse_error, done);
199
-	load_TR_value(p, s, time_rec, tr_parse_interval, parse_error, done);
200
-	load_TR_value(p, s, time_rec, tr_parse_byday, parse_error, done);
201
-	load_TR_value(p, s, time_rec, tr_parse_bymday, parse_error, done);
202
-	load_TR_value(p, s, time_rec, tr_parse_byyday, parse_error, done);
203
-	load_TR_value(p, s, time_rec, tr_parse_byweekno, parse_error, done);
204
-	load_TR_value(p, s, time_rec, tr_parse_bymonth, parse_error, done);
195
+	load_TR_value(p, s, time_rec, dr_tr_parse_dtstart, parse_error, done);
196
+	load_TR_value(p, s, time_rec, dr_tr_parse_duration, parse_error, done);
197
+	load_TR_value(p, s, time_rec, dr_tr_parse_freq, parse_error, done);
198
+	load_TR_value(p, s, time_rec, dr_tr_parse_until, parse_error, done);
199
+	load_TR_value(p, s, time_rec, dr_tr_parse_interval, parse_error, done);
200
+	load_TR_value(p, s, time_rec, dr_tr_parse_byday, parse_error, done);
201
+	load_TR_value(p, s, time_rec, dr_tr_parse_bymday, parse_error, done);
202
+	load_TR_value(p, s, time_rec, dr_tr_parse_byyday, parse_error, done);
203
+	load_TR_value(p, s, time_rec, dr_tr_parse_byweekno, parse_error, done);
204
+	load_TR_value(p, s, time_rec, dr_tr_parse_bymonth, parse_error, done);
205 205
 
206 206
 /* success */
207 207
 done:
... ...
@@ -211,7 +211,7 @@ parse_error:
211 211
 			(int)(long)(p - time_str));
212 212
 error:
213 213
 	if(time_rec)
214
-		tmrec_free(time_rec);
214
+		dr_tmrec_free(time_rec);
215 215
 	return 0;
216 216
 }
217 217
 
... ...
@@ -287,7 +287,7 @@ rt_data_t *dr_load_routing_info(db_func_t *dr_dbf, db1_con_t *db_hdl,
287 287
 	db_row_t *row;
288 288
 	rt_info_t *ri;
289 289
 	rt_data_t *rdata;
290
-	tmrec_t *time_rec;
290
+	dr_tmrec_t *time_rec;
291 291
 	unsigned int id;
292 292
 	str s_id;
293 293
 	int i, n;
... ...
@@ -550,7 +550,7 @@ rt_data_t *dr_load_routing_info(db_func_t *dr_dbf, db1_con_t *db_hdl,
550 550
 				LM_ERR("failed to add routing info for rule id %d -> "
551 551
 					   "skipping\n",
552 552
 						int_vals[0]);
553
-				tmrec_free(time_rec);
553
+				dr_tmrec_free(time_rec);
554 554
 				continue;
555 555
 			}
556 556
 			/* add the rule */
... ...
@@ -93,21 +93,21 @@ static inline char *trim(char *_s)
93 93
 	(int)(((t)->tm_yday + 7 - ((t)->tm_wday ? (t)->tm_wday - 1 : 6)) / 7)
94 94
 #endif
95 95
 
96
-#define ac_get_wday_yr(t) (int)((t)->tm_yday / 7)
97
-#define ac_get_wday_mr(t) (int)(((t)->tm_mday - 1) / 7)
96
+#define dr_ac_get_wday_yr(t) (int)((t)->tm_yday / 7)
97
+#define dr_ac_get_wday_mr(t) (int)(((t)->tm_mday - 1) / 7)
98 98
 
99
-ac_tm_p ac_tm_new(void)
99
+dr_ac_tm_p dr_ac_tm_new(void)
100 100
 {
101
-	ac_tm_p _atp = NULL;
102
-	_atp = (ac_tm_p)shm_malloc(sizeof(ac_tm_t));
101
+	dr_ac_tm_p _atp = NULL;
102
+	_atp = (dr_ac_tm_p)shm_malloc(sizeof(dr_ac_tm_t));
103 103
 	if(!_atp)
104 104
 		return NULL;
105
-	memset(_atp, 0, sizeof(ac_tm_t));
105
+	memset(_atp, 0, sizeof(dr_ac_tm_t));
106 106
 
107 107
 	return _atp;
108 108
 }
109 109
 
110
-int ac_tm_fill(ac_tm_p _atp, struct tm *_tm)
110
+int dr_ac_tm_fill(dr_ac_tm_p _atp, struct tm *_tm)
111 111
 {
112 112
 	if(!_atp || !_tm)
113 113
 		return -1;
... ...
@@ -121,24 +121,24 @@ int ac_tm_fill(ac_tm_p _atp, struct tm *_tm)
121 121
 	_atp->t.tm_yday = _tm->tm_yday;   /* day in the year */
122 122
 	_atp->t.tm_isdst = _tm->tm_isdst; /* daylight saving time */
123 123
 
124
-	_atp->mweek = ac_get_mweek(_tm);
125
-	_atp->yweek = ac_get_yweek(_tm);
126
-	_atp->ywday = ac_get_wday_yr(_tm);
127
-	_atp->mwday = ac_get_wday_mr(_tm);
124
+	_atp->mweek = dr_ac_get_mweek(_tm);
125
+	_atp->yweek = dr_ac_get_yweek(_tm);
126
+	_atp->ywday = dr_ac_get_wday_yr(_tm);
127
+	_atp->mwday = dr_ac_get_wday_mr(_tm);
128 128
 	return 0;
129 129
 }
130 130
 
131
-int ac_tm_set_time(ac_tm_p _atp, time_t _t)
131
+int dr_ac_tm_set_time(dr_ac_tm_p _atp, time_t _t)
132 132
 {
133 133
 	struct tm _tm;
134 134
 	if(!_atp)
135 135
 		return -1;
136 136
 	_atp->time = _t;
137 137
 	localtime_r(&_t, &_tm);
138
-	return ac_tm_fill(_atp, &_tm);
138
+	return dr_ac_tm_fill(_atp, &_tm);
139 139
 }
140 140
 
141
-int ac_get_mweek(struct tm *_tm)
141
+int dr_ac_get_mweek(struct tm *_tm)
142 142
 {
143 143
 	if(!_tm)
144 144
 		return -1;
... ...
@@ -151,7 +151,7 @@ int ac_get_mweek(struct tm *_tm)
151 151
 #endif
152 152
 }
153 153
 
154
-int ac_get_yweek(struct tm *_tm)
154
+int dr_ac_get_yweek(struct tm *_tm)
155 155
 {
156 156
 	int week = -1;
157 157
 #ifdef USE_YWEEK_V
... ...
@@ -178,7 +178,7 @@ int ac_get_yweek(struct tm *_tm)
178 178
 	return week;
179 179
 }
180 180
 
181
-int ac_get_wkst(void)
181
+int dr_ac_get_wkst(void)
182 182
 {
183 183
 #ifdef USE_YWEEK_U
184 184
 	return 0;
... ...
@@ -187,15 +187,15 @@ int ac_get_wkst(void)
187 187
 #endif
188 188
 }
189 189
 
190
-int ac_tm_reset(ac_tm_p _atp)
190
+int dr_ac_tm_reset(dr_ac_tm_p _atp)
191 191
 {
192 192
 	if(!_atp)
193 193
 		return -1;
194
-	memset(_atp, 0, sizeof(ac_tm_t));
194
+	memset(_atp, 0, sizeof(dr_ac_tm_t));
195 195
 	return 0;
196 196
 }
197 197
 
198
-int ac_tm_free(ac_tm_p _atp)
198
+int dr_ac_tm_free(dr_ac_tm_p _atp)
199 199
 {
200 200
 	if(!_atp)
201 201
 		return -1;
... ...
@@ -205,23 +205,23 @@ int ac_tm_free(ac_tm_p _atp)
205 205
 	return 0;
206 206
 }
207 207
 
208
-ac_maxval_p ac_get_maxval(ac_tm_p _atp, int mode)
208
+dr_ac_maxval_p dr_ac_get_maxval(dr_ac_tm_p _atp, int mode)
209 209
 {
210 210
 	struct tm _tm;
211 211
 	int _v;
212
-	ac_maxval_p _amp = NULL;
213
-	static ac_maxval_t _amv;
212
+	dr_ac_maxval_p _amp = NULL;
213
+	static dr_ac_maxval_t _amv;
214 214
 
215 215
 	if(!_atp)
216 216
 		return NULL;
217 217
 	if(mode==1) {
218
-		_amp = (ac_maxval_p)shm_malloc(sizeof(ac_maxval_t));
218
+		_amp = (dr_ac_maxval_p)shm_malloc(sizeof(dr_ac_maxval_t));
219 219
 		if(!_amp)
220 220
 			return NULL;
221 221
 	} else {
222 222
 		_amp = &_amv;
223 223
 	}
224
-	memset(_amp, 0, sizeof(ac_maxval_t));
224
+	memset(_amp, 0, sizeof(dr_ac_maxval_t));
225 225
 
226 226
 	/* the number of the days in the year */
227 227
 	_amp->yday = 365 + is_leap_year(_atp->t.tm_year + 1900);
... ...
@@ -258,7 +258,7 @@ ac_maxval_p ac_get_maxval(ac_tm_p _atp, int mode)
258 258
 	_amp->ywday = (int)((_tm.tm_yday - _v) / 7) + 1;
259 259
 
260 260
 	/* maximum number of weeks in the year */
261
-	_amp->yweek = ac_get_yweek(&_tm) + 1;
261
+	_amp->yweek = dr_ac_get_yweek(&_tm) + 1;
262 262
 
263 263
 	/* maximum number of the week day in the month */
264 264
 	_amp->mwday =
... ...
@@ -292,17 +292,17 @@ ac_maxval_p ac_get_maxval(ac_tm_p _atp, int mode)
292 292
 
293 293
 #define _D(c) ((c) - '0')
294 294
 
295
-tr_byxxx_p tr_byxxx_new(void)
295
+dr_tr_byxxx_p dr_tr_byxxx_new(void)
296 296
 {
297
-	tr_byxxx_p _bxp = NULL;
298
-	_bxp = (tr_byxxx_p)shm_malloc(sizeof(tr_byxxx_t));
297
+	dr_tr_byxxx_p _bxp = NULL;
298
+	_bxp = (dr_tr_byxxx_p)shm_malloc(sizeof(dr_tr_byxxx_t));
299 299
 	if(!_bxp)
300 300
 		return NULL;
301
-	memset(_bxp, 0, sizeof(tr_byxxx_t));
301
+	memset(_bxp, 0, sizeof(dr_tr_byxxx_t));
302 302
 	return _bxp;
303 303
 }
304 304
 
305
-int tr_byxxx_init(tr_byxxx_p _bxp, int _nr)
305
+int dr_tr_byxxx_init(dr_tr_byxxx_p _bxp, int _nr)
306 306
 {
307 307
 	if(!_bxp)
308 308
 		return -1;
... ...
@@ -323,7 +323,7 @@ int tr_byxxx_init(tr_byxxx_p _bxp, int _nr)
323 323
 }
324 324
 
325 325
 
326
-int tr_byxxx_free(tr_byxxx_p _bxp)
326
+int dr_tr_byxxx_free(dr_tr_byxxx_p _bxp)
327 327
 {
328 328
 	if(!_bxp)
329 329
 		return -1;
... ...
@@ -335,67 +335,67 @@ int tr_byxxx_free(tr_byxxx_p _bxp)
335 335
 	return 0;
336 336
 }
337 337
 
338
-tmrec_p tmrec_new(void)
338
+dr_tmrec_p dr_tmrec_new(void)
339 339
 {
340
-	tmrec_p _trp = NULL;
341
-	_trp = (tmrec_p)shm_malloc(sizeof(tmrec_t));
340
+	dr_tmrec_p _trp = NULL;
341
+	_trp = (dr_tmrec_p)shm_malloc(sizeof(dr_tmrec_t));
342 342
 	if(!_trp)
343 343
 		return NULL;
344
-	memset(_trp, 0, sizeof(tmrec_t));
344
+	memset(_trp, 0, sizeof(dr_tmrec_t));
345 345
 	localtime_r(&_trp->dtstart, &(_trp->ts));
346 346
 	return _trp;
347 347
 }
348 348
 
349
-int tmrec_free(tmrec_p _trp)
349
+int dr_tmrec_free(dr_tmrec_p _trp)
350 350
 {
351 351
 	if(!_trp)
352 352
 		return -1;
353 353
 
354
-	tr_byxxx_free(_trp->byday);
355
-	tr_byxxx_free(_trp->bymday);
356
-	tr_byxxx_free(_trp->byyday);
357
-	tr_byxxx_free(_trp->bymonth);
358
-	tr_byxxx_free(_trp->byweekno);
354
+	dr_tr_byxxx_free(_trp->byday);
355
+	dr_tr_byxxx_free(_trp->bymday);
356
+	dr_tr_byxxx_free(_trp->byyday);
357
+	dr_tr_byxxx_free(_trp->bymonth);
358
+	dr_tr_byxxx_free(_trp->byweekno);
359 359
 
360 360
 	shm_free(_trp);
361 361
 	return 0;
362 362
 }
363 363
 
364
-int tr_parse_dtstart(tmrec_p _trp, char *_in)
364
+int dr_tr_parse_dtstart(dr_tmrec_p _trp, char *_in)
365 365
 {
366 366
 	if(!_trp || !_in)
367 367
 		return -1;
368
-	_trp->dtstart = ic_parse_datetime(_in, &(_trp->ts));
368
+	_trp->dtstart = dr_ic_parse_datetime(_in, &(_trp->ts));
369 369
 	return (_trp->dtstart == 0) ? -1 : 0;
370 370
 }
371 371
 
372
-int tr_parse_dtend(tmrec_p _trp, char *_in)
372
+int dr_tr_parse_dtend(dr_tmrec_p _trp, char *_in)
373 373
 {
374 374
 	struct tm _tm;
375 375
 	if(!_trp || !_in)
376 376
 		return -1;
377
-	_trp->dtend = ic_parse_datetime(_in, &_tm);
377
+	_trp->dtend = dr_ic_parse_datetime(_in, &_tm);
378 378
 	return (_trp->dtend == 0) ? -1 : 0;
379 379
 }
380 380
 
381
-int tr_parse_duration(tmrec_p _trp, char *_in)
381
+int dr_tr_parse_duration(dr_tmrec_p _trp, char *_in)
382 382
 {
383 383
 	if(!_trp || !_in)
384 384
 		return -1;
385
-	_trp->duration = ic_parse_duration(_in);
385
+	_trp->duration = dr_ic_parse_duration(_in);
386 386
 	return 0;
387 387
 }
388 388
 
389
-int tr_parse_until(tmrec_p _trp, char *_in)
389
+int dr_tr_parse_until(dr_tmrec_p _trp, char *_in)
390 390
 {
391 391
 	struct tm _tm;
392 392
 	if(!_trp || !_in)
393 393
 		return -1;
394
-	_trp->until = ic_parse_datetime(_in, &_tm);
394
+	_trp->until = dr_ic_parse_datetime(_in, &_tm);
395 395
 	return 0;
396 396
 }
397 397
 
398
-int tr_parse_freq(tmrec_p _trp, char *_in)
398
+int dr_tr_parse_freq(dr_tmrec_p _trp, char *_in)
399 399
 {
400 400
 	if(!_trp || !_in)
401 401
 		return -1;
... ...
@@ -424,7 +424,7 @@ int tr_parse_freq(tmrec_p _trp, char *_in)
424 424
 	return 0;
425 425
 }
426 426
 
427
-int tr_parse_interval(tmrec_p _trp, char *_in)
427
+int dr_tr_parse_interval(dr_tmrec_p _trp, char *_in)
428 428
 {
429 429
 	if(!_trp || !_in)
430 430
 		return -1;
... ...
@@ -432,56 +432,56 @@ int tr_parse_interval(tmrec_p _trp, char *_in)
432 432
 	return 0;
433 433
 }
434 434
 
435
-int tr_parse_byday(tmrec_p _trp, char *_in)
435
+int dr_tr_parse_byday(dr_tmrec_p _trp, char *_in)
436 436
 {
437 437
 	if(!_trp || !_in)
438 438
 		return -1;
439
-	_trp->byday = ic_parse_byday(_in);
439
+	_trp->byday = dr_ic_parse_byday(_in);
440 440
 	return 0;
441 441
 }
442 442
 
443
-int tr_parse_bymday(tmrec_p _trp, char *_in)
443
+int dr_tr_parse_bymday(dr_tmrec_p _trp, char *_in)
444 444
 {
445 445
 	if(!_trp || !_in)
446 446
 		return -1;
447
-	_trp->bymday = ic_parse_byxxx(_in);
447
+	_trp->bymday = dr_ic_parse_byxxx(_in);
448 448
 	return 0;
449 449
 }
450 450
 
451
-int tr_parse_byyday(tmrec_p _trp, char *_in)
451
+int dr_tr_parse_byyday(dr_tmrec_p _trp, char *_in)
452 452
 {
453 453
 	if(!_trp || !_in)
454 454
 		return -1;
455
-	_trp->byyday = ic_parse_byxxx(_in);
455
+	_trp->byyday = dr_ic_parse_byxxx(_in);
456 456
 	return 0;
457 457
 }
458 458
 
459
-int tr_parse_bymonth(tmrec_p _trp, char *_in)
459
+int dr_tr_parse_bymonth(dr_tmrec_p _trp, char *_in)
460 460
 {
461 461
 	if(!_trp || !_in)
462 462
 		return -1;
463
-	_trp->bymonth = ic_parse_byxxx(_in);
463
+	_trp->bymonth = dr_ic_parse_byxxx(_in);
464 464
 	return 0;
465 465
 }
466 466
 
467
-int tr_parse_byweekno(tmrec_p _trp, char *_in)
467
+int dr_tr_parse_byweekno(dr_tmrec_p _trp, char *_in)
468 468
 {
469 469
 	if(!_trp || !_in)
470 470
 		return -1;
471
-	_trp->byweekno = ic_parse_byxxx(_in);
471
+	_trp->byweekno = dr_ic_parse_byxxx(_in);
472 472
 	return 0;
473 473
 }
474 474
 
475
-int tr_parse_wkst(tmrec_p _trp, char *_in)
475
+int dr_tr_parse_wkst(dr_tmrec_p _trp, char *_in)
476 476
 {
477 477
 	if(!_trp || !_in)
478 478
 		return -1;
479
-	_trp->wkst = ic_parse_wkst(_in);
479
+	_trp->wkst = dr_ic_parse_wkst(_in);
480 480
 	return 0;
481 481
 }
482 482
 
483 483
 
484
-time_t ic_parse_datetime(char *_in, struct tm *_tm)
484
+time_t dr_ic_parse_datetime(char *_in, struct tm *_tm)
485 485
 {
486 486
 	if(!_in || !_tm || strlen(_in) != 15)
487 487
 		return 0;
... ...
@@ -498,7 +498,7 @@ time_t ic_parse_datetime(char *_in, struct tm *_tm)
498 498
 	return mktime(_tm);
499 499
 }
500 500
 
501
-time_t ic_parse_duration(char *_in)
501
+time_t dr_ic_parse_duration(char *_in)
502 502
 {
503 503
 	time_t _t, _ft;
504 504
 	char *_p;
... ...
@@ -607,15 +607,15 @@ time_t ic_parse_duration(char *_in)
607 607
 	return _ft;
608 608
 }
609 609
 
610
-tr_byxxx_p ic_parse_byday(char *_in)
610
+dr_tr_byxxx_p dr_ic_parse_byday(char *_in)
611 611
 {
612
-	tr_byxxx_p _bxp = NULL;
612
+	dr_tr_byxxx_p _bxp = NULL;
613 613
 	int _nr, _s, _v;
614 614
 	char *_p;
615 615
 
616 616
 	if(!_in)
617 617
 		return NULL;
618
-	_bxp = tr_byxxx_new();
618
+	_bxp = dr_tr_byxxx_new();
619 619
 	if(!_bxp)
620 620
 		return NULL;
621 621
 	_p = _in;
... ...
@@ -625,8 +625,8 @@ tr_byxxx_p ic_parse_byday(char *_in)
625 625
 			_nr++;
626 626
 		_p++;
627 627
 	}
628
-	if(tr_byxxx_init(_bxp, _nr) < 0) {
629
-		tr_byxxx_free(_bxp);
628
+	if(dr_tr_byxxx_init(_bxp, _nr) < 0) {
629
+		dr_tr_byxxx_free(_bxp);
630 630
 		return NULL;
631 631
 	}
632 632
 	_p = _in;
... ...
@@ -736,19 +736,19 @@ tr_byxxx_p ic_parse_byday(char *_in)
736 736
 	return _bxp;
737 737
 
738 738
 error:
739
-	tr_byxxx_free(_bxp);
739
+	dr_tr_byxxx_free(_bxp);
740 740
 	return NULL;
741 741
 }
742 742
 
743
-tr_byxxx_p ic_parse_byxxx(char *_in)
743
+dr_tr_byxxx_p dr_ic_parse_byxxx(char *_in)
744 744
 {
745
-	tr_byxxx_p _bxp = NULL;
745
+	dr_tr_byxxx_p _bxp = NULL;
746 746
 	int _nr, _s, _v;
747 747
 	char *_p;
748 748
 
749 749
 	if(!_in)
750 750
 		return NULL;
751
-	_bxp = tr_byxxx_new();
751
+	_bxp = dr_tr_byxxx_new();
752 752
 	if(!_bxp)
753 753
 		return NULL;
754 754
 	_p = _in;
... ...
@@ -758,8 +758,8 @@ tr_byxxx_p ic_parse_byxxx(char *_in)
758 758
 			_nr++;
759 759
 		_p++;
760 760
 	}
761
-	if(tr_byxxx_init(_bxp, _nr) < 0) {
762
-		tr_byxxx_free(_bxp);
761
+	if(dr_tr_byxxx_init(_bxp, _nr) < 0) {
762
+		dr_tr_byxxx_free(_bxp);
763 763
 		return NULL;
764 764
 	}
765 765
 	_p = _in;
... ...
@@ -806,11 +806,11 @@ tr_byxxx_p ic_parse_byxxx(char *_in)
806 806
 	return _bxp;
807 807
 
808 808
 error:
809
-	tr_byxxx_free(_bxp);
809
+	dr_tr_byxxx_free(_bxp);
810 810
 	return NULL;
811 811
 }
812 812
 
813
-int ic_parse_wkst(char *_in)
813
+int dr_ic_parse_wkst(char *_in)
814 814
 {
815 815
 	if(!_in || strlen(_in) != 2)
816 816
 		goto error;
... ...
@@ -878,10 +878,10 @@ error:
878 878
 #define _IS_SET(x) (((x) > 0) ? 1 : 0)
879 879
 
880 880
 /*** local headers ***/
881
-int get_min_interval(tmrec_p);
882
-int check_min_unit(tmrec_p, ac_tm_p, tr_res_p);
883
-int check_freq_interval(tmrec_p _trp, ac_tm_p _atp);
884
-int check_byxxx(tmrec_p, ac_tm_p);
881
+int dr_get_min_interval(dr_tmrec_p);
882
+int dr_check_min_unit(dr_tmrec_p, dr_ac_tm_p, dr_tr_res_p);
883
+int dr_check_freq_interval(dr_tmrec_p _trp, dr_ac_tm_p _atp);
884
+int dr_check_byxxx(dr_tmrec_p, dr_ac_tm_p);
885 885
 
886 886
 /**
887 887
  *
... ...
@@ -889,7 +889,7 @@ int check_byxxx(tmrec_p, ac_tm_p);
889 889
  *       -1/REC_ERR - error
890 890
  *        1/REC_NOMATCH - the time falls out
891 891
  */
892
-int check_tmrec(tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw)
892
+int dr_check_tmrec(dr_tmrec_p _trp, dr_ac_tm_p _atp, dr_tr_res_p _tsw)
893 893
 {
894 894
 	if(!_trp || !_atp)
895 895
 		return REC_ERR;
... ...
@@ -924,20 +924,20 @@ int check_tmrec(tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw)
924 924
 		return REC_NOMATCH;
925 925
 
926 926
 	/* check if the instance of recurrence matches the 'interval' */
927
-	if(check_freq_interval(_trp, _atp) != REC_MATCH)
927
+	if(dr_check_freq_interval(_trp, _atp) != REC_MATCH)
928 928
 		return REC_NOMATCH;
929 929
 
930
-	if(check_min_unit(_trp, _atp, _tsw) != REC_MATCH)
930
+	if(dr_check_min_unit(_trp, _atp, _tsw) != REC_MATCH)
931 931
 		return REC_NOMATCH;
932 932
 
933
-	if(check_byxxx(_trp, _atp) != REC_MATCH)
933
+	if(dr_check_byxxx(_trp, _atp) != REC_MATCH)
934 934
 		return REC_NOMATCH;
935 935
 
936 936
 	return REC_MATCH;
937 937
 }
938 938
 
939 939
 
940
-int check_freq_interval(tmrec_p _trp, ac_tm_p _atp)
940
+int dr_check_freq_interval(dr_tmrec_p _trp, dr_ac_tm_p _atp)
941 941
 {
942 942
 	int _t0, _t1;
943 943
 	struct tm _tm;
... ...
@@ -990,7 +990,7 @@ int check_freq_interval(tmrec_p _trp, ac_tm_p _atp)
990 990
 	return REC_NOMATCH;
991 991
 }
992 992
 
993
-int get_min_interval(tmrec_p _trp)
993
+int dr_get_min_interval(dr_tmrec_p _trp)
994 994
 {
995 995
 	if(!_trp)
996 996
 		return FREQ_NOFREQ;
... ...
@@ -1007,12 +1007,12 @@ int get_min_interval(tmrec_p _trp)
1007 1007
 	return FREQ_NOFREQ;
1008 1008
 }
1009 1009
 
1010
-int check_min_unit(tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw)
1010
+int dr_check_min_unit(dr_tmrec_p _trp, dr_ac_tm_p _atp, dr_tr_res_p _tsw)
1011 1011
 {
1012 1012
 	int _v0, _v1;
1013 1013
 	if(!_trp || !_atp)
1014 1014
 		return REC_ERR;
1015
-	switch(get_min_interval(_trp)) {
1015
+	switch(dr_get_min_interval(_trp)) {
1016 1016
 		case FREQ_DAILY:
1017 1017
 			break;
1018 1018
 		case FREQ_WEEKLY:
... ...
@@ -1049,17 +1049,17 @@ int check_min_unit(tmrec_p _trp, ac_tm_p _atp, tr_res_p _tsw)
1049 1049
 	return REC_NOMATCH;
1050 1050
 }
1051 1051
 
1052
-int check_byxxx(tmrec_p _trp, ac_tm_p _atp)
1052
+int dr_check_byxxx(dr_tmrec_p _trp, dr_ac_tm_p _atp)
1053 1053
 {
1054 1054
 	int i;
1055
-	ac_maxval_p _amp = NULL;
1055
+	dr_ac_maxval_p _amp = NULL;
1056 1056
 	if(!_trp || !_atp)
1057 1057
 		return REC_ERR;
1058 1058
 	if(!_trp->byday && !_trp->bymday && !_trp->byyday && !_trp->bymonth
1059 1059
 			&& !_trp->byweekno)
1060 1060
 		return REC_MATCH;
1061 1061
 
1062
-	_amp = ac_get_maxval(_atp, 0);
1062
+	_amp = dr_ac_get_maxval(_atp, 0);
1063 1063
 	if(!_amp)
1064 1064
 		return REC_NOMATCH;
1065 1065
 
... ...
@@ -54,7 +54,7 @@ typedef struct _ac_maxval
54 54
 	int mweek;
55 55
 	int mday;
56 56
 	int mwday;
57
-} ac_maxval_t, *ac_maxval_p;
57
+} dr_ac_maxval_t, *dr_ac_maxval_p;
58 58
 
59 59
 typedef struct _ac_tm
60 60
 {
... ...
@@ -64,22 +64,22 @@ typedef struct _ac_tm
64 64
 	int yweek;
65 65
 	int ywday;
66 66
 	int mwday;
67
-	ac_maxval_p mv;
68
-} ac_tm_t, *ac_tm_p;
67
+	dr_ac_maxval_p mv;
68
+} dr_ac_tm_t, *dr_ac_tm_p;
69 69
 
70
-ac_tm_p ac_tm_new();
70
+dr_ac_tm_p dr_ac_tm_new();
71 71
 
72
-int ac_tm_set_time(ac_tm_p, time_t);
72
+int dr_ac_tm_set_time(dr_ac_tm_p, time_t);
73 73
 
74
-int ac_tm_reset(ac_tm_p);
75
-int ac_tm_free(ac_tm_p);
74
+int dr_ac_tm_reset(dr_ac_tm_p);
75
+int dr_ac_tm_free(dr_ac_tm_p);
76 76
 
77
-int ac_get_mweek(struct tm *);
78
-int ac_get_yweek(struct tm *);
79
-ac_maxval_p ac_get_maxval(ac_tm_p, int);
80
-int ac_get_wkst();
77
+int dr_ac_get_mweek(struct tm *);
78
+int dr_ac_get_yweek(struct tm *);
79
+dr_ac_maxval_p dr_ac_get_maxval(dr_ac_tm_p, int);
80
+int dr_ac_get_wkst();
81 81
 
82
-int ac_print(ac_tm_p);
82
+int dr_ac_print(dr_ac_tm_p);
83 83
 
84 84
 
85 85
 /************************ imported from "tmrec.h"  ***************************/
... ...
@@ -103,14 +103,14 @@ int ac_print(ac_tm_p);
103 103
 #define TSW_TSET 1
104 104
 #define TSW_RSET 2
105 105
 
106
-typedef struct _tr_byxxx
106
+typedef struct _dr_tr_byxxx
107 107
 {
108 108
 	int nr;
109 109
 	int *xxx;
110 110
 	int *req;
111
-} tr_byxxx_t, *tr_byxxx_p;
111
+} dr_tr_byxxx_t, *dr_tr_byxxx_p;
112 112
 
113
-typedef struct _tmrec
113
+typedef struct _dr_tmrec
114 114
 {
115 115
 	time_t dtstart;
116 116
 	struct tm ts;
... ...
@@ -119,49 +119,49 @@ typedef struct _tmrec
119 119
 	time_t until;
120 120
 	int freq;
121 121
 	int interval;
122
-	tr_byxxx_p byday;
123
-	tr_byxxx_p bymday;
124
-	tr_byxxx_p byyday;
125
-	tr_byxxx_p bymonth;
126
-	tr_byxxx_p byweekno;
122
+	dr_tr_byxxx_p byday;
123
+	dr_tr_byxxx_p bymday;
124
+	dr_tr_byxxx_p byyday;
125
+	dr_tr_byxxx_p bymonth;
126
+	dr_tr_byxxx_p byweekno;
127 127
 	int wkst;
128
-} tmrec_t, *tmrec_p;
128
+} dr_tmrec_t, *dr_tmrec_p;
129 129
 
130
-typedef struct _tr_res
130
+typedef struct _dr_tr_res
131 131
 {
132 132
 	int flag;
133 133
 	time_t rest;
134
-} tr_res_t, *tr_res_p;
135
-
136
-tr_byxxx_p tr_byxxx_new();
137
-int tr_byxxx_init(tr_byxxx_p, int);
138
-int tr_byxxx_free(tr_byxxx_p);
139
-
140
-tmrec_p tmrec_new();
141
-int tmrec_free(tmrec_p);
142
-
143
-int tr_parse_dtstart(tmrec_p, char *);
144
-int tr_parse_dtend(tmrec_p, char *);
145
-int tr_parse_duration(tmrec_p, char *);
146
-int tr_parse_until(tmrec_p, char *);
147
-int tr_parse_freq(tmrec_p, char *);
148
-int tr_parse_interval(tmrec_p, char *);
149
-int tr_parse_byday(tmrec_p, char *);
150
-int tr_parse_bymday(tmrec_p, char *);
151
-int tr_parse_byyday(tmrec_p, char *);
152
-int tr_parse_bymonth(tmrec_p, char *);
153
-int tr_parse_byweekno(tmrec_p, char *);
154
-int tr_parse_wkst(tmrec_p, char *);
155
-
156
-int tr_print(tmrec_p);
157
-time_t ic_parse_datetime(char *, struct tm *);
158
-time_t ic_parse_duration(char *);
159
-
160
-tr_byxxx_p ic_parse_byday(char *);
161
-tr_byxxx_p ic_parse_byxxx(char *);
162
-int ic_parse_wkst(char *);
163
-
164
-int check_tmrec(tmrec_p, ac_tm_p, tr_res_p);
134
+} dr_tr_res_t, *dr_tr_res_p;
135
+
136
+dr_tr_byxxx_p dr_tr_byxxx_new();
137
+int dr_tr_byxxx_init(dr_tr_byxxx_p, int);
138
+int dr_tr_byxxx_free(dr_tr_byxxx_p);
139
+
140
+dr_tmrec_p dr_tmrec_new();
141
+int dr_tmrec_free(dr_tmrec_p);
142
+
143
+int dr_tr_parse_dtstart(dr_tmrec_p, char *);
144
+int dr_tr_parse_dtend(dr_tmrec_p, char *);
145
+int dr_tr_parse_duration(dr_tmrec_p, char *);
146
+int dr_tr_parse_until(dr_tmrec_p, char *);
147
+int dr_tr_parse_freq(dr_tmrec_p, char *);
148
+int dr_tr_parse_interval(dr_tmrec_p, char *);
149
+int dr_tr_parse_byday(dr_tmrec_p, char *);
150
+int dr_tr_parse_bymday(dr_tmrec_p, char *);
151
+int dr_tr_parse_byyday(dr_tmrec_p, char *);
152
+int dr_tr_parse_bymonth(dr_tmrec_p, char *);
153
+int dr_tr_parse_byweekno(dr_tmrec_p, char *);
154
+int dr_tr_parse_wkst(dr_tmrec_p, char *);
155
+
156
+int dr_tr_print(dr_tmrec_p);
157
+time_t dr_ic_parse_datetime(char *, struct tm *);
158
+time_t dr_ic_parse_duration(char *);
159
+
160
+dr_tr_byxxx_p dr_ic_parse_byday(char *);
161
+dr_tr_byxxx_p dr_ic_parse_byxxx(char *);
162
+int dr_ic_parse_wkst(char *);
163
+
164
+int dr_check_tmrec(dr_tmrec_p, dr_ac_tm_p, dr_tr_res_p);
165 165
 
166 166
 
167 167
 #endif
... ...
@@ -34,9 +34,9 @@ extern int inode;
34 34
 extern int unode;
35 35
 
36 36
 
37
-static inline int check_time(tmrec_t *time_rec)
37
+static inline int check_time(dr_tmrec_t *time_rec)
38 38
 {
39
-	ac_tm_t att;
39
+	dr_ac_tm_t att;
40 40
 
41 41
 	/* shortcut: if there is no dstart, timerec is valid */
42 42
 	if(time_rec->dtstart == 0)
... ...
@@ -45,11 +45,11 @@ static inline int check_time(tmrec_t *time_rec)
45 45
 	memset(&att, 0, sizeof(att));
46 46
 
47 47
 	/* set current time */
48
-	if(ac_tm_set_time(&att, time(0)))
48
+	if(dr_ac_tm_set_time(&att, time(0)))
49 49
 		return 0;
50 50
 
51 51
 	/* does the recv_time match the specified interval?  */
52
-	if(check_tmrec(time_rec, &att, 0) != 0)
52
+	if(dr_check_tmrec(time_rec, &att, 0) != 0)
53 53
 		return 0;
54 54
 
55 55
 	return 1;
... ...
@@ -249,7 +249,7 @@ void free_rt_info(rt_info_t *rl)
249 249
 	if(NULL != rl->pgwl)
250 250
 		shm_free(rl->pgwl);
251 251
 	if(NULL != rl->time_rec)
252
-		tmrec_free(rl->time_rec);
252
+		dr_tmrec_free(rl->time_rec);
253 253
 	shm_free(rl);
254 254
 	return;
255 255
 }
... ...
@@ -80,7 +80,7 @@ typedef struct pgw_list_
80 80
 typedef struct rt_info_
81 81
 {
82 82
 	unsigned int priority;
83
-	tmrec_t *time_rec;
83
+	dr_tmrec_t *time_rec;
84 84
 	/* array of pointers into the PSTN gw list */
85 85
 	pgw_list_t *pgwl;
86 86
 	/* length of the PSTN gw array */
... ...
@@ -56,7 +56,7 @@ err_exit:
56 56
 }
57 57
 
58 58
 
59
-rt_info_t *build_rt_info(int priority, tmrec_t *trec,
59
+rt_info_t *build_rt_info(int priority, dr_tmrec_t *trec,
60 60
 		/* script routing table index */
61 61
 		int route_idx,
62 62
 		/* list of destinations indexes */
... ...
@@ -91,7 +91,7 @@ int add_dst(rt_data_t *,
91 91
 		char *);
92 92
 
93 93
 /* build a routing info list element */
94
-rt_info_t *build_rt_info(int priority, tmrec_t *time,
94
+rt_info_t *build_rt_info(int priority, dr_tmrec_t *time,
95 95
 		/* ser routing table id */
96 96
 		int route_id,
97 97
 		/* list of destinations indexes */