FreeCalypso > hg > themwi-system-sw
view smpp-trx-sa/enq_link_stat.c @ 267:81958b35f74d
NANP validation: allow made-up area codes of N9X form
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 13 Nov 2023 15:28:09 -0800 |
parents | 1bf989f60aa3 |
children |
line wrap: on
line source
/* * This module tracks and logs the times of enquire_link packets * from the SMPP server. */ #include <sys/types.h> #include <sys/file.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <strings.h> #include <time.h> #include <unistd.h> extern char fmt_time[32]; static int status_fd, status_enable; static char last_enq_time[32]; void log_enquire_link_open(filename) char *filename; { status_fd = open(filename, O_WRONLY|O_CREAT|O_TRUNC, 0666); if (status_fd < 0) { perror(filename); exit(1); } status_enable = 1; } static void write_enq_link_times() { char buf[128]; sprintf(buf, "%s\n%s\n", last_enq_time, fmt_time); lseek(status_fd, 0, SEEK_SET); write(status_fd, buf, strlen(buf)); } void log_enquire_link_item() { if (!status_enable) return; if (last_enq_time[0]) write_enq_link_times(); strcpy(last_enq_time, fmt_time); }