Kannel: Open Source WAP and SMS gateway  svn-r5335
test_smsc.c File Reference
#include <unistd.h>
#include "gwlib/gwlib.h"
#include "gw/smsc/smpp_pdu.h"
#include <string.h>

Go to the source code of this file.

Data Structures

struct  Event
 
struct  smsc_emu_arg
 
struct  smpp_emu_arg
 
struct  httpd_emu_arg
 

Macros

#define TYPE(name)   case name: return #name;
 

Typedefs

typedef List EventQueue
 
typedef struct Event Event
 

Enumerations

enum  { MAX_THREADS = 2 }
 
enum  { SMPP_MAX_QUEUE = 10 }
 
enum  { MAX_IN_AVERAGE = 100 }
 
enum  { MAX_RTT = 1 }
 
enum  { MAX_WAITING = 100 }
 
enum  { MAX_IN_QUEUE = 1000 }
 

Functions

static const char * eq_type (Event *e)
 
static Eventeq_create_event (enum event_type type)
 
static Eventeq_create_submit (Connection *conn, long sequence_number, Octstr *body)
 
static Eventeq_create_http_request (HTTPClient *client, Octstr *body)
 
static void eq_destroy_event (Event *e)
 
static EventQueueeq_create (void)
 
static void eq_add_producer (EventQueue *eq)
 
static void eq_remove_producer (EventQueue *eq)
 
static void eq_destroy (EventQueue *eq)
 
static void eq_append (EventQueue *eq, Event *e)
 
static Eventeq_extract (EventQueue *eq)
 
static void eq_log (Event *e)
 
static void eq_init (void)
 
static void eq_shutdown (void)
 
static long eq_round_trip_time (Event *e)
 
static void smpp_emu_writer (void *arg)
 
static void smpp_emu_handle_pdu (struct smpp_emu_arg *p, SMPP_PDU *pdu)
 
static void smpp_emu_reader (void *arg)
 
static void smpp_emu (void *arg)
 
static void smsc_emu_create (EventQueue *eq)
 
static void smsc_emu_destroy (void)
 
static void smsc_emu_deliver (void)
 
static void smsc_emu_submit_ack (Event *e)
 
static void smsc_emu_init (void)
 
static void smsc_emu_shutdown (void)
 
static void httpd_emu (void *arg)
 
static void httpd_emu_create (EventQueue *eq)
 
static void httpd_emu_destroy (void)
 
static void httpd_emu_reply (Event *e)
 
static void httpd_emu_init (void)
 
static void httpd_emu_shutdown (void)
 
static void kill_kannel (void)
 
static void sustained_level_benchmark (void)
 
static void n_messages_benchmark (void)
 
int main (int argc, char **argv)
 

Variables

static long http_port = 8080
 
static long admin_port = 13000
 
static char * admin_password = "bar"
 
static long smpp_port = 2345
 
static long num_messages = 1
 
static Counterevent_id_counter = NULL
 
static EventQueueundelivered_messages = NULL
 
static Countersmpp_emu_counter = NULL
 
static long smpp_emu_id = -1
 
static Listhttpd_emu_headers = NULL
 
static long httpd_emu_tid = -1
 

Macro Definition Documentation

◆ TYPE

#define TYPE (   name)    case name: return #name;

Referenced by eq_type().

Typedef Documentation

◆ Event

typedef struct Event Event

◆ EventQueue

typedef List EventQueue

Definition at line 97 of file test_smsc.c.

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
MAX_THREADS 

Definition at line 279 of file test_smsc.c.

279 { MAX_THREADS = 2 };

◆ anonymous enum

anonymous enum
Enumerator
SMPP_MAX_QUEUE 

Definition at line 280 of file test_smsc.c.

280 { SMPP_MAX_QUEUE = 10 };

◆ anonymous enum

anonymous enum
Enumerator
MAX_IN_AVERAGE 

Definition at line 720 of file test_smsc.c.

720 { MAX_IN_AVERAGE = 100 };

◆ anonymous enum

anonymous enum
Enumerator
MAX_RTT 

Definition at line 721 of file test_smsc.c.

721 { MAX_RTT = 1 };

◆ anonymous enum

anonymous enum
Enumerator
MAX_WAITING 

Definition at line 722 of file test_smsc.c.

722 { MAX_WAITING = 100 };

◆ anonymous enum

anonymous enum
Enumerator
MAX_IN_QUEUE 

Definition at line 820 of file test_smsc.c.

820 { MAX_IN_QUEUE = 1000 };

Function Documentation

◆ eq_add_producer()

static void eq_add_producer ( EventQueue eq)
static

Definition at line 201 of file test_smsc.c.

References gwlist_add_producer().

Referenced by httpd_emu(), smpp_emu(), and smsc_emu_init().

202 {
204 }
void gwlist_add_producer(List *list)
Definition: list.c:383

◆ eq_append()

static void eq_append ( EventQueue eq,
Event e 
)
static

Definition at line 219 of file test_smsc.c.

References gwlist_produce().

Referenced by httpd_emu(), smpp_emu_handle_pdu(), and smsc_emu_deliver().

220 {
221  gwlist_produce(eq, e);
222 }
void gwlist_produce(List *list, void *item)
Definition: list.c:411

◆ eq_create()

static EventQueue* eq_create ( void  )
static

Definition at line 195 of file test_smsc.c.

References gwlist_create.

Referenced by n_messages_benchmark(), smsc_emu_init(), and sustained_level_benchmark().

196 {
197  return gwlist_create();
198 }
#define gwlist_create()
Definition: list.h:136

◆ eq_create_event()

static Event* eq_create_event ( enum event_type  type)
static

Definition at line 142 of file test_smsc.c.

References Event::body, Event::client, Event::conn, counter_increase(), date_universal_now(), event_id_counter, Event::id, Event::sequence_number, Event::time, Event::type, and type.

Referenced by eq_create_http_request(), eq_create_submit(), smpp_emu_handle_pdu(), and smsc_emu_deliver().

143 {
144  Event *e;
145 
146  e = gw_malloc(sizeof(*e));
147  e->type = type;
148  e->time = date_universal_now();
150  e->conn = NULL;
151  e->sequence_number = -1;
152  e->client = NULL;
153  e->body = NULL;
154  return e;
155 }
long time
Definition: test_smsc.c:111
Octstr * body
Definition: test_smsc.c:118
int type
Definition: smsc_cimd2.c:215
long id
Definition: test_smsc.c:110
unsigned long counter_increase(Counter *counter)
Definition: counter.c:123
long sequence_number
Definition: test_smsc.c:114
long date_universal_now(void)
Definition: date.c:340
enum Event::event_type type
Connection * conn
Definition: test_smsc.c:113
static Counter * event_id_counter
Definition: test_smsc.c:122
HTTPClient * client
Definition: test_smsc.c:117

◆ eq_create_http_request()

static Event* eq_create_http_request ( HTTPClient client,
Octstr body 
)
static

Definition at line 174 of file test_smsc.c.

References Event::body, client(), Event::client, eq_create_event(), gw_assert(), and octstr_duplicate.

Referenced by httpd_emu().

175 {
176  Event *e;
177 
178  gw_assert(client != NULL);
179  gw_assert(body != NULL);
180 
181  e = eq_create_event(http_request);
182  e->client = client;
183  e->body = octstr_duplicate(body);
184  return e;
185 }
gw_assert(wtls_machine->packet_to_send !=NULL)
Octstr * body
Definition: test_smsc.c:118
static void client(int port)
Definition: test_udp.c:77
static Event * eq_create_event(enum event_type type)
Definition: test_smsc.c:142
#define octstr_duplicate(ostr)
Definition: octstr.h:187
HTTPClient * client
Definition: test_smsc.c:117

◆ eq_create_submit()

static Event* eq_create_submit ( Connection conn,
long  sequence_number,
Octstr body 
)
static

Definition at line 158 of file test_smsc.c.

References Event::body, Event::conn, eq_create_event(), gw_assert(), octstr_duplicate, and Event::sequence_number.

Referenced by smpp_emu_handle_pdu().

160 {
161  Event *e;
162 
163  gw_assert(conn != NULL);
164  gw_assert(sequence_number >= 0);
165 
166  e = eq_create_event(submit);
167  e->conn = conn;
168  e->sequence_number = sequence_number;
169  e->body = octstr_duplicate(body);
170  return e;
171 }
gw_assert(wtls_machine->packet_to_send !=NULL)
Octstr * body
Definition: test_smsc.c:118
static Event * eq_create_event(enum event_type type)
Definition: test_smsc.c:142
#define octstr_duplicate(ostr)
Definition: octstr.h:187
long sequence_number
Definition: test_smsc.c:114
Connection * conn
Definition: test_smsc.c:113

◆ eq_destroy()

static void eq_destroy ( EventQueue eq)
static

Definition at line 213 of file test_smsc.c.

References gwlist_destroy().

Referenced by n_messages_benchmark(), smsc_emu_shutdown(), and sustained_level_benchmark().

214 {
215  gwlist_destroy(eq, NULL);
216 }
void gwlist_destroy(List *list, gwlist_item_destructor_t *destructor)
Definition: list.c:145

◆ eq_destroy_event()

static void eq_destroy_event ( Event e)
static

Definition at line 188 of file test_smsc.c.

References Event::body, and octstr_destroy().

Referenced by n_messages_benchmark(), smpp_emu_writer(), and sustained_level_benchmark().

189 {
190  octstr_destroy(e->body);
191  gw_free(e);
192 }
Octstr * body
Definition: test_smsc.c:118
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324

◆ eq_extract()

static Event* eq_extract ( EventQueue eq)
static

Definition at line 225 of file test_smsc.c.

References gwlist_consume().

Referenced by n_messages_benchmark(), smpp_emu_writer(), and sustained_level_benchmark().

226 {
227  return gwlist_consume(eq);
228 }
void * gwlist_consume(List *list)
Definition: list.c:427

◆ eq_init()

static void eq_init ( void  )
static

Definition at line 237 of file test_smsc.c.

References counter_create(), and event_id_counter.

Referenced by main().

238 {
240 }
Counter * counter_create(void)
Definition: counter.c:94
static Counter * event_id_counter
Definition: test_smsc.c:122

◆ eq_log()

static void eq_log ( Event e)
static

Definition at line 231 of file test_smsc.c.

References eq_type(), Event::id, info(), and Event::time.

Referenced by n_messages_benchmark(), smpp_emu_writer(), and sustained_level_benchmark().

232 {
233  info(0, "Event %ld, type %s, time %ld", e->id, eq_type(e), e->time);
234 }
void info(int err, const char *fmt,...)
Definition: log.c:672
long time
Definition: test_smsc.c:111
long id
Definition: test_smsc.c:110
static const char * eq_type(Event *e)
Definition: test_smsc.c:125

◆ eq_remove_producer()

static void eq_remove_producer ( EventQueue eq)
static

Definition at line 207 of file test_smsc.c.

References gwlist_remove_producer().

Referenced by httpd_emu(), smpp_emu(), and smsc_emu_destroy().

208 {
210 }
void gwlist_remove_producer(List *list)
Definition: list.c:401

◆ eq_round_trip_time()

static long eq_round_trip_time ( Event e)
static

Definition at line 249 of file test_smsc.c.

References Event::body, date_universal_now(), and octstr_parse_long().

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

250 {
251  long now, then;
252 
253  now = date_universal_now();
254  if (octstr_parse_long(&then, e->body, 0, 10) == -1)
255  return 0;
256  return now - then;
257 }
Octstr * body
Definition: test_smsc.c:118
long date_universal_now(void)
Definition: date.c:340
long octstr_parse_long(long *nump, Octstr *ostr, long pos, int base)
Definition: octstr.c:749

◆ eq_shutdown()

static void eq_shutdown ( void  )
static

Definition at line 243 of file test_smsc.c.

References counter_destroy(), and event_id_counter.

Referenced by main().

244 {
246 }
void counter_destroy(Counter *counter)
Definition: counter.c:110
static Counter * event_id_counter
Definition: test_smsc.c:122

◆ eq_type()

static const char* eq_type ( Event e)
static

Definition at line 125 of file test_smsc.c.

References Event::type, and TYPE.

Referenced by eq_log(), n_messages_benchmark(), and sustained_level_benchmark().

126 {
127 #define TYPE(name) case name: return #name;
128  switch (e->type) {
129  TYPE(got_smsc)
130  TYPE(deliver)
131  TYPE(deliver_ack)
132  TYPE(http_request)
133  TYPE(http_response)
134  TYPE(submit)
135  TYPE(got_enquire_link)
136  }
137 #undef TYPE
138  return "unknown";
139 }
#define TYPE(name)
enum Event::event_type type

◆ httpd_emu()

static void httpd_emu ( void *  arg)
static

Definition at line 584 of file test_smsc.c.

References client(), httpd_emu_arg::eq, eq_add_producer(), eq_append(), eq_create_http_request(), eq_remove_producer(), http_accept_request(), http_cgi_variable(), http_destroy_cgiargs(), http_destroy_headers(), octstr_destroy(), httpd_emu_arg::port, httpd_emu_arg::sema, semaphore_up(), and url.

Referenced by httpd_emu_create().

585 {
587  Octstr *ip;
588  Octstr *url;
589  List *headers;
590  Octstr *body;
591  List *cgivars;
592  struct httpd_emu_arg *p;
593  EventQueue *eq;
594 
595  p = arg;
596  eq = p->eq;
598  semaphore_up(p->sema);
599 
600  for (;;) {
601  client = http_accept_request(p->port, &ip, &url, &headers, &body,
602  &cgivars);
603  if (client == NULL)
604  break;
605 
607  http_cgi_variable(cgivars, "arg")));
608  octstr_destroy(ip);
610  http_destroy_headers(headers);
611  octstr_destroy(body);
612  http_destroy_cgiargs(cgivars);
613  }
615  gw_free(p);
616 }
static void client(int port)
Definition: test_udp.c:77
static void eq_append(EventQueue *eq, Event *e)
Definition: test_smsc.c:219
static void eq_add_producer(EventQueue *eq)
Definition: test_smsc.c:201
Octstr * http_cgi_variable(List *list, char *name)
Definition: http.c:2836
void http_destroy_headers(List *headers)
Definition: http.c:2879
void http_destroy_cgiargs(List *args)
Definition: http.c:2818
Semaphore * sema
Definition: test_smsc.c:576
HTTPClient * http_accept_request(int port, Octstr **client_ip, Octstr **url, List **headers, Octstr **body, List **cgivars)
Definition: http.c:2571
static void eq_remove_producer(EventQueue *eq)
Definition: test_smsc.c:207
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
static Event * eq_create_http_request(HTTPClient *client, Octstr *body)
Definition: test_smsc.c:174
void semaphore_up(Semaphore *semaphore)
Definition: gw-semaphore.c:118
Definition: octstr.c:118
EventQueue * eq
Definition: test_smsc.c:577
static Octstr * url
Definition: test_xmlrpc.c:84
Definition: list.c:102

◆ httpd_emu_create()

static void httpd_emu_create ( EventQueue eq)
static

Definition at line 630 of file test_smsc.c.

References httpd_emu_arg::eq, gw_assert(), gwthread_create, http_open_port(), http_port, httpd_emu(), httpd_emu_tid, panic, httpd_emu_arg::port, httpd_emu_arg::sema, semaphore_create(), semaphore_destroy(), semaphore_down(), and ssl.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

631 {
632  struct httpd_emu_arg *arg;
633  int ssl = 0; /* indicate if SSL-enabled server should be used */
634 
635  if (http_open_port(http_port, ssl) == -1)
636  panic(0, "Can't open HTTP server emulator port %ld.", http_port);
637 
638  gw_assert(httpd_emu_tid == -1);
639  arg = gw_malloc(sizeof(*arg));
640  arg->port = http_port;
641  arg->sema = semaphore_create(0);
642  arg->eq = eq;
644  if (httpd_emu_tid == -1)
645  panic(0, "Can't start the HTTP server emulator thread.");
646  semaphore_down(arg->sema);
647  semaphore_destroy(arg->sema);
648 }
gw_assert(wtls_machine->packet_to_send !=NULL)
int ssl
void semaphore_destroy(Semaphore *semaphore)
Definition: gw-semaphore.c:104
static long httpd_emu_tid
Definition: test_smsc.c:623
void semaphore_down(Semaphore *semaphore)
Definition: gw-semaphore.c:132
static void httpd_emu(void *arg)
Definition: test_smsc.c:584
Semaphore * sema
Definition: test_smsc.c:576
#define gwthread_create(func, arg)
Definition: gwthread.h:90
int http_open_port(int port, int ssl)
Definition: http.c:2509
EventQueue * eq
Definition: test_smsc.c:577
#define panic
Definition: log.h:87
Semaphore * semaphore_create(long n)
Definition: gw-semaphore.c:81
static long http_port
Definition: test_smsc.c:70

◆ httpd_emu_destroy()

static void httpd_emu_destroy ( void  )
static

Definition at line 655 of file test_smsc.c.

References gw_assert(), gwthread_join(), http_close_all_ports(), and httpd_emu_tid.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

656 {
657  gw_assert(httpd_emu_tid != -1);
660  httpd_emu_tid = -1;
661 }
gw_assert(wtls_machine->packet_to_send !=NULL)
void gwthread_join(long thread)
static long httpd_emu_tid
Definition: test_smsc.c:623
void http_close_all_ports(void)
Definition: http.c:2526

◆ httpd_emu_init()

static void httpd_emu_init ( void  )
static

Definition at line 673 of file test_smsc.c.

References http_create_empty_headers(), http_header_add(), and httpd_emu_headers.

Referenced by main().

674 {
676  http_header_add(httpd_emu_headers, "Content-Type", "text/plain");
677 }
void http_header_add(List *headers, char *name, char *contents)
Definition: http.c:2886
List * http_create_empty_headers(void)
Definition: http.c:2872
static List * httpd_emu_headers
Definition: test_smsc.c:571

◆ httpd_emu_reply()

static void httpd_emu_reply ( Event e)
static

Definition at line 667 of file test_smsc.c.

References Event::body, Event::client, HTTP_OK, http_send_reply(), and httpd_emu_headers.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

668 {
670 }
Octstr * body
Definition: test_smsc.c:118
void http_send_reply(HTTPClient *client, int status, List *headers, Octstr *body)
Definition: http.c:2695
Definition: http.h:142
static List * httpd_emu_headers
Definition: test_smsc.c:571
HTTPClient * client
Definition: test_smsc.c:117

◆ httpd_emu_shutdown()

static void httpd_emu_shutdown ( void  )
static

Definition at line 680 of file test_smsc.c.

References http_destroy_headers(), and httpd_emu_headers.

Referenced by main().

681 {
683 }
void http_destroy_headers(List *headers)
Definition: http.c:2879
static List * httpd_emu_headers
Definition: test_smsc.c:571

◆ kill_kannel()

static void kill_kannel ( void  )
static

Definition at line 691 of file test_smsc.c.

References admin_password, admin_port, http_create_empty_headers(), http_destroy_headers(), http_get_real(), http_header_add(), HTTP_METHOD_GET, octstr_destroy(), octstr_format(), and url.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

692 {
693  Octstr *url;
694  Octstr *final_url;
695  List *req_headers;
696  List *reply_headers;
697  Octstr *reply_body;
698  int ret;
699 
700  url = octstr_format("http://localhost:%ld/shutdown?password=%s",
702  req_headers = http_create_empty_headers();
703  http_header_add(req_headers, "Content-Type", "text/plain");
704  ret = http_get_real(HTTP_METHOD_GET, url, req_headers, &final_url,
705  &reply_headers, &reply_body);
706  if (ret != -1) {
707  octstr_destroy(final_url);
708  http_destroy_headers(reply_headers);
709  octstr_destroy(reply_body);
710  }
712  http_destroy_headers(req_headers);
713 }
void http_header_add(List *headers, char *name, char *contents)
Definition: http.c:2886
static char * admin_password
Definition: test_smsc.c:77
void http_destroy_headers(List *headers)
Definition: http.c:2879
List * http_create_empty_headers(void)
Definition: http.c:2872
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
int http_get_real(int method, Octstr *url, List *request_headers, Octstr **final_url, List **reply_headers, Octstr **reply_body)
Definition: http.c:1821
Definition: octstr.c:118
static long admin_port
Definition: test_smsc.c:76
static Octstr * url
Definition: test_xmlrpc.c:84
Definition: list.c:102

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 902 of file test_smsc.c.

References eq_init(), eq_shutdown(), getopt(), gwlib_init(), gwlib_shutdown(), httpd_emu_init(), httpd_emu_shutdown(), n_messages_benchmark(), name, num_messages, optarg, smsc_emu_init(), smsc_emu_shutdown(), and sustained_level_benchmark().

903 {
904  int opt;
905  char *main_name;
906  int i;
907  static struct {
908  char *name;
909  void (*func)(void);
910  } tab[] = {
911  { "n_messages", n_messages_benchmark },
912  { "sustained_level", sustained_level_benchmark },
913  };
914 
915  gwlib_init();
916  eq_init();
917  httpd_emu_init();
918  smsc_emu_init();
919 
920  main_name = "n_messages_benchmark";
921 
922  while ((opt = getopt(argc, argv, "m:r:")) != EOF) {
923  switch (opt) {
924  case 'm':
925  main_name = optarg;
926  break;
927  case 'r':
928  num_messages = atoi(optarg);
929  break;
930  }
931  }
932 
933  for (i = 0; (size_t) i < sizeof(tab) / sizeof(tab[0]); ++i) {
934  if (strcmp(main_name, tab[i].name) == 0) {
935  tab[i].func();
936  break;
937  }
938  }
939 
942  eq_shutdown();
943  gwlib_shutdown();
944  return 0;
945 }
static long num_messages
Definition: test_smsc.c:90
static void smsc_emu_shutdown(void)
Definition: test_smsc.c:559
static void n_messages_benchmark(void)
Definition: test_smsc.c:822
int getopt(int argc, char **argv, char *opts)
Definition: attgetopt.c:84
static void httpd_emu_shutdown(void)
Definition: test_smsc.c:680
static void smsc_emu_init(void)
Definition: test_smsc.c:551
static void eq_shutdown(void)
Definition: test_smsc.c:243
static void httpd_emu_init(void)
Definition: test_smsc.c:673
static void sustained_level_benchmark(void)
Definition: test_smsc.c:724
char * name
Definition: smsc_cimd2.c:212
static void eq_init(void)
Definition: test_smsc.c:237
char * optarg
Definition: attgetopt.c:82
void gwlib_shutdown(void)
Definition: gwlib.c:94
void gwlib_init(void)
Definition: gwlib.c:78

◆ n_messages_benchmark()

static void n_messages_benchmark ( void  )
static

Definition at line 822 of file test_smsc.c.

References debug(), httpd_emu_arg::eq, eq_create(), eq_destroy(), eq_destroy_event(), eq_extract(), eq_log(), eq_round_trip_time(), eq_type(), httpd_emu_create(), httpd_emu_destroy(), httpd_emu_reply(), kill_kannel(), MAX_IN_QUEUE, num_messages, smsc_emu_create(), smsc_emu_deliver(), smsc_emu_destroy(), smsc_emu_submit_ack(), and Event::type.

Referenced by main().

823 {
824  EventQueue *eq;
825  Event *e;
826  long i;
827  long num_submit;
828  long num_in_queue;
829  long num_deliver;
830 
831  eq = eq_create();
832 
833  httpd_emu_create(eq);
834  smsc_emu_create(eq);
835 
836  /* Wait for an SMS center client to appear. */
837  while ((e = eq_extract(eq)) != NULL && e->type != got_smsc)
838  debug("test_smsc", 0, "Discarding event of type %s", eq_type(e));
839  debug("test_smsc", 0, "Got event got_smsc.");
840  eq_destroy_event(e);
841 
842  /* Send the SMS messages, or at least fill the send queue. */
843  for (i = 0; i < num_messages && i < MAX_IN_QUEUE; ++i)
845  num_in_queue = i;
846  num_deliver = i;
847 
848  /*
849  * Wait for results to be processed. When send queue is not full,
850  * fill it.
851  */
852  num_submit = 0;
853  while (num_submit < num_messages && (e = eq_extract(eq)) != NULL) {
854  while (num_deliver < num_messages && num_in_queue < MAX_IN_QUEUE) {
856  ++num_in_queue;
857  ++num_deliver;
858  }
859 
860  eq_log(e);
861 
862  switch (e->type) {
863  case deliver_ack:
864  break;
865 
866  case http_request:
867  httpd_emu_reply(e);
868  break;
869 
870  case submit:
871  debug("", 0, "RTT = %ld", eq_round_trip_time(e));
873  ++num_submit;
874  --num_in_queue;
875  break;
876 
877  case got_enquire_link:
878  break;
879 
880  default:
881  debug("test_smsc", 0, "Ignoring event of type %s", eq_type(e));
882  break;
883  }
884 
885  eq_destroy_event(e);
886  }
887 
888  kill_kannel();
889 
890  debug("test_smsc", 0, "Terminating benchmark.");
893  eq_destroy(eq);
894 }
static long num_messages
Definition: test_smsc.c:90
static Event * eq_extract(EventQueue *eq)
Definition: test_smsc.c:225
static void eq_log(Event *e)
Definition: test_smsc.c:231
static void eq_destroy_event(Event *e)
Definition: test_smsc.c:188
static void httpd_emu_destroy(void)
Definition: test_smsc.c:655
static void smsc_emu_deliver(void)
Definition: test_smsc.c:532
static void httpd_emu_create(EventQueue *eq)
Definition: test_smsc.c:630
static void smsc_emu_destroy(void)
Definition: test_smsc.c:523
static EventQueue * eq_create(void)
Definition: test_smsc.c:195
static void smsc_emu_submit_ack(Event *e)
Definition: test_smsc.c:538
static const char * eq_type(Event *e)
Definition: test_smsc.c:125
static void kill_kannel(void)
Definition: test_smsc.c:691
static void smsc_emu_create(EventQueue *eq)
Definition: test_smsc.c:505
enum Event::event_type type
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:726
static void httpd_emu_reply(Event *e)
Definition: test_smsc.c:667
static void eq_destroy(EventQueue *eq)
Definition: test_smsc.c:213
Definition: list.c:102
static long eq_round_trip_time(Event *e)
Definition: test_smsc.c:249

◆ smpp_emu()

static void smpp_emu ( void *  arg)
static

Definition at line 433 of file test_smsc.c.

References smpp_emu_arg::conn, conn_destroy(), conn_wrap_fd(), smsc_emu_arg::eq, smpp_emu_arg::eq, eq_add_producer(), eq_remove_producer(), gw_accept(), gwthread_create, gwthread_join(), gwthread_wakeup(), smpp_emu_arg::id, make_server_socket(), MAX_THREADS, octstr_destroy(), smpp_emu_arg::ok_to_send, panic, smpp_emu_arg::quit, smsc_emu_arg::sema, semaphore_create(), semaphore_destroy(), semaphore_up(), smpp_emu_reader(), SMPP_MAX_QUEUE, smpp_port, warning(), and smpp_emu_arg::writer_id.

Referenced by smsc_emu_create().

434 {
435  EventQueue *eq;
436  struct smsc_emu_arg *p;
437  int fd;
438  int new_fd;
439  Octstr *client_addr;
440  long i;
441  long num_threads;
442  struct smpp_emu_arg *thread[MAX_THREADS];
443 
444  p = arg;
445  eq = p->eq;
447  semaphore_up(p->sema);
448 
449  /*
450  * Wait for SMPP clients.
451  */
452  fd = make_server_socket(smpp_port, NULL);
453  if (fd == -1)
454  panic(0, "Couldn't create SMPP listen port.");
455 
456  num_threads = 0;
457  for (;;) {
458  new_fd = gw_accept(fd, &client_addr);
459  if (new_fd == -1)
460  break;
461  octstr_destroy(client_addr);
462  if (num_threads == MAX_THREADS) {
463  warning(0, "Too many SMPP client connections.");
464  (void) close(new_fd);
465  } else {
466  thread[num_threads] = gw_malloc(sizeof(*thread[0]));
467  thread[num_threads]->conn = conn_wrap_fd(new_fd, 0);
468  thread[num_threads]->eq = eq;
469  thread[num_threads]->quit = 0;
470  thread[num_threads]->writer_id = -1;
471  thread[num_threads]->ok_to_send =
473  thread[num_threads]->id =
474  gwthread_create(smpp_emu_reader, thread[num_threads]);
475  if (thread[num_threads]->id == -1)
476  panic(0, "Couldn't start SMPP subthread.");
477  ++num_threads;
478  }
479  }
480 
481  for (i = 0; i < num_threads; ++i) {
482  thread[i]->quit = 1;
483  gwthread_wakeup(thread[i]->id);
484  gwthread_join(thread[i]->id);
485  conn_destroy(thread[i]->conn);
486  semaphore_destroy(thread[i]->ok_to_send);
487  gw_free(thread[i]);
488  }
489 
491 }
Semaphore * ok_to_send
Definition: test_smsc.c:287
void semaphore_destroy(Semaphore *semaphore)
Definition: gw-semaphore.c:104
void gwthread_join(long thread)
EventQueue * eq
Definition: test_smsc.c:267
static void eq_add_producer(EventQueue *eq)
Definition: test_smsc.c:201
EventQueue * eq
Definition: test_smsc.c:284
Connection * conn
Definition: test_smsc.c:285
int gw_accept(int fd, Octstr **client_addr)
Definition: socket.c:700
void conn_destroy(Connection *conn)
Definition: conn.c:627
static void eq_remove_producer(EventQueue *eq)
Definition: test_smsc.c:207
long writer_id
Definition: test_smsc.c:288
int make_server_socket(int port, const char *interface_name)
Definition: socket.c:93
void warning(int err, const char *fmt,...)
Definition: log.c:660
Semaphore * sema
Definition: test_smsc.c:266
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define gwthread_create(func, arg)
Definition: gwthread.h:90
static long smpp_port
Definition: test_smsc.c:83
void semaphore_up(Semaphore *semaphore)
Definition: gw-semaphore.c:118
Definition: octstr.c:118
#define panic
Definition: log.h:87
void gwthread_wakeup(long thread)
static void smpp_emu_reader(void *arg)
Definition: test_smsc.c:383
Semaphore * semaphore_create(long n)
Definition: gw-semaphore.c:81
Definition: list.c:102
Connection * conn_wrap_fd(int fd, int ssl)
Definition: conn.c:566

◆ smpp_emu_handle_pdu()

static void smpp_emu_handle_pdu ( struct smpp_emu_arg p,
SMPP_PDU pdu 
)
static

Definition at line 325 of file test_smsc.c.

References smpp_emu_arg::conn, conn_write(), smpp_emu_arg::eq, eq_append(), eq_create_event(), eq_create_submit(), error(), gw_assert(), gwthread_create, octstr_destroy(), smpp_emu_arg::ok_to_send, panic, semaphore_up(), smpp_emu_writer(), smpp_pdu_create(), smpp_pdu_destroy(), smpp_pdu_pack(), SMPP_PDU::type, SMPP_PDU::type_name, SMPP_PDU::u, and smpp_emu_arg::writer_id.

Referenced by smpp_emu_reader().

326 {
327  SMPP_PDU *resp;
328  Octstr *os;
329 
330  resp = NULL;
331  switch (pdu->type) {
332  case bind_transmitter:
333  resp = smpp_pdu_create(bind_transmitter_resp,
334  pdu->u.bind_transmitter.sequence_number);
335  break;
336 
337  case bind_receiver:
338  resp = smpp_pdu_create(bind_receiver_resp,
339  pdu->u.bind_receiver.sequence_number);
340  eq_append(p->eq, eq_create_event(got_smsc));
341  gw_assert(p->writer_id == -1);
343  if (p->writer_id == -1)
344  panic(0, "Couldn't create SMPP helper thread.");
345  break;
346 
347  case submit_sm:
348  eq_append(p->eq,
349  eq_create_submit(p->conn, pdu->u.submit_sm.sequence_number,
350  pdu->u.submit_sm.short_message));
351  break;
352 
353  case deliver_sm_resp:
354  eq_append(p->eq, eq_create_event(deliver_ack));
356  break;
357 
358  case enquire_link:
359  eq_append(p->eq, eq_create_event(got_enquire_link));
360  resp = smpp_pdu_create(enquire_link_resp,
361  pdu->u.enquire_link.sequence_number);
362  break;
363 
364  case unbind:
365  resp = smpp_pdu_create(unbind_resp,
366  pdu->u.unbind.sequence_number);
367  break;
368 
369  default:
370  error(0, "SMPP: Unhandled PDU type %s", pdu->type_name);
371  break;
372  }
373 
374  if (resp != NULL) {
375  os = smpp_pdu_pack(NULL, resp);
376  conn_write(p->conn, os);
377  octstr_destroy(os);
378  smpp_pdu_destroy(resp);
379  }
380 }
void smpp_pdu_destroy(SMPP_PDU *pdu)
Definition: smpp_pdu.c:434
void error(int err, const char *fmt,...)
Definition: log.c:648
Semaphore * ok_to_send
Definition: test_smsc.c:287
gw_assert(wtls_machine->packet_to_send !=NULL)
static void smpp_emu_writer(void *arg)
Definition: test_smsc.c:296
const char * type_name
Definition: smpp_pdu.h:92
unsigned long type
Definition: smpp_pdu.h:91
static void eq_append(EventQueue *eq, Event *e)
Definition: test_smsc.c:219
EventQueue * eq
Definition: test_smsc.c:284
Connection * conn
Definition: test_smsc.c:285
int conn_write(Connection *conn, Octstr *data)
Definition: conn.c:1051
static Event * eq_create_event(enum event_type type)
Definition: test_smsc.c:142
Octstr * smpp_pdu_pack(Octstr *smsc_id, SMPP_PDU *pdu)
Definition: smpp_pdu.c:458
long writer_id
Definition: test_smsc.c:288
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define gwthread_create(func, arg)
Definition: gwthread.h:90
union SMPP_PDU::@15 u
void semaphore_up(Semaphore *semaphore)
Definition: gw-semaphore.c:118
Definition: octstr.c:118
#define panic
Definition: log.h:87
static Event * eq_create_submit(Connection *conn, long sequence_number, Octstr *body)
Definition: test_smsc.c:158
SMPP_PDU * smpp_pdu_create(unsigned long type, unsigned long seq_no)
Definition: smpp_pdu.c:400

◆ smpp_emu_reader()

static void smpp_emu_reader ( void *  arg)
static

Definition at line 383 of file test_smsc.c.

References smpp_emu_arg::conn, conn_eof(), conn_error(), conn_wait(), error(), gw_assert(), gwthread_join(), octstr_destroy(), octstr_dump, smpp_emu_arg::quit, smpp_emu_handle_pdu(), smpp_pdu_destroy(), smpp_pdu_read_data(), smpp_pdu_read_len(), smpp_pdu_unpack(), and smpp_emu_arg::writer_id.

Referenced by smpp_emu().

384 {
385  Octstr *os;
386  long len;
387  SMPP_PDU *pdu;
388  struct smpp_emu_arg *p;
389 
390  p = arg;
391 
392  len = 0;
393  while (!p->quit && conn_wait(p->conn, -1.0) != -1) {
394  for (;;) {
395  if (len == 0) {
396  len = smpp_pdu_read_len(p->conn);
397  if (len == -1) {
398  error(0, "Client sent garbage, closing connection.");
399  goto error;
400  } else if (len == 0) {
401  if (conn_eof(p->conn) || conn_error(p->conn))
402  goto error;
403  break;
404  }
405  }
406 
407  gw_assert(len > 0);
408  os = smpp_pdu_read_data(p->conn, len);
409  if (os != NULL) {
410  len = 0;
411  pdu = smpp_pdu_unpack(NULL, os);
412  if (pdu == NULL) {
413  error(0, "PDU unpacking failed!");
414  octstr_dump(os, 0);
415  } else {
416  smpp_emu_handle_pdu(p, pdu);
417  smpp_pdu_destroy(pdu);
418  }
419  octstr_destroy(os);
420  } else if (conn_eof(p->conn) || conn_error(p->conn))
421  goto error;
422  else
423  break;
424  }
425  }
426 
427 error:
428  if (p->writer_id != -1)
430 }
void smpp_pdu_destroy(SMPP_PDU *pdu)
Definition: smpp_pdu.c:434
void error(int err, const char *fmt,...)
Definition: log.c:648
gw_assert(wtls_machine->packet_to_send !=NULL)
void gwthread_join(long thread)
static void smpp_emu_handle_pdu(struct smpp_emu_arg *p, SMPP_PDU *pdu)
Definition: test_smsc.c:325
long smpp_pdu_read_len(Connection *conn)
Definition: smpp_pdu.c:869
int conn_eof(Connection *conn)
Definition: conn.c:705
Connection * conn
Definition: test_smsc.c:285
#define octstr_dump(ostr, level,...)
Definition: octstr.h:564
SMPP_PDU * smpp_pdu_unpack(Octstr *smsc_id, Octstr *data_without_len)
Definition: smpp_pdu.c:597
long writer_id
Definition: test_smsc.c:288
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Octstr * smpp_pdu_read_data(Connection *conn, long len)
Definition: smpp_pdu.c:895
Definition: octstr.c:118
int conn_wait(Connection *conn, double seconds)
Definition: conn.c:904
int conn_error(Connection *conn)
Definition: conn.c:716

◆ smpp_emu_writer()

static void smpp_emu_writer ( void *  arg)
static

Definition at line 296 of file test_smsc.c.

References smpp_emu_arg::conn, conn_write(), counter_increase(), date_universal_now(), eq_destroy_event(), eq_extract(), eq_log(), octstr_create, octstr_destroy(), octstr_format(), smpp_emu_arg::ok_to_send, semaphore_down(), smpp_emu_counter, smpp_pdu_create(), smpp_pdu_destroy(), smpp_pdu_pack(), Event::time, SMPP_PDU::u, and undelivered_messages.

Referenced by smpp_emu_handle_pdu().

297 {
298  Event *e;
299  SMPP_PDU *pdu;
300  Octstr *os;
301  struct smpp_emu_arg *p;
302 
303  p = arg;
304  for (;;) {
307  if (e == NULL)
308  break;
309  e->time = date_universal_now();
310  eq_log(e);
311  pdu = smpp_pdu_create(deliver_sm,
313  pdu->u.deliver_sm.source_addr = octstr_create("123");
314  pdu->u.deliver_sm.destination_addr = octstr_create("456");
315  pdu->u.deliver_sm.short_message = octstr_format("%ld", e->time);
316  os = smpp_pdu_pack(NULL, pdu);
317  conn_write(p->conn, os);
318  octstr_destroy(os);
319  smpp_pdu_destroy(pdu);
320  eq_destroy_event(e);
321  }
322 }
void smpp_pdu_destroy(SMPP_PDU *pdu)
Definition: smpp_pdu.c:434
static Event * eq_extract(EventQueue *eq)
Definition: test_smsc.c:225
long time
Definition: test_smsc.c:111
Semaphore * ok_to_send
Definition: test_smsc.c:287
static void eq_log(Event *e)
Definition: test_smsc.c:231
static void eq_destroy_event(Event *e)
Definition: test_smsc.c:188
static Counter * smpp_emu_counter
Definition: test_smsc.c:293
unsigned long counter_increase(Counter *counter)
Definition: counter.c:123
void semaphore_down(Semaphore *semaphore)
Definition: gw-semaphore.c:132
Connection * conn
Definition: test_smsc.c:285
int conn_write(Connection *conn, Octstr *data)
Definition: conn.c:1051
Octstr * smpp_pdu_pack(Octstr *smsc_id, SMPP_PDU *pdu)
Definition: smpp_pdu.c:458
Octstr * octstr_format(const char *fmt,...)
Definition: octstr.c:2464
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
#define octstr_create(cstr)
Definition: octstr.h:125
union SMPP_PDU::@15 u
static EventQueue * undelivered_messages
Definition: test_smsc.c:271
long date_universal_now(void)
Definition: date.c:340
Definition: octstr.c:118
SMPP_PDU * smpp_pdu_create(unsigned long type, unsigned long seq_no)
Definition: smpp_pdu.c:400

◆ smsc_emu_create()

static void smsc_emu_create ( EventQueue eq)
static

Definition at line 505 of file test_smsc.c.

References smsc_emu_arg::eq, gw_assert(), gwthread_create, panic, smsc_emu_arg::sema, semaphore_create(), semaphore_destroy(), semaphore_down(), smpp_emu(), and smpp_emu_id.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

506 {
507  struct smsc_emu_arg *arg;
508 
509  gw_assert(smpp_emu_id == -1);
510 
511  arg = gw_malloc(sizeof(*arg));
512  arg->sema = semaphore_create(0);
513  arg->eq = eq;
515  if (smpp_emu_id == -1)
516  panic(0, "Couldn't start SMPP emulator thread.");
517  semaphore_down(arg->sema);
518  semaphore_destroy(arg->sema);
519  gw_free(arg);
520 }
gw_assert(wtls_machine->packet_to_send !=NULL)
void semaphore_destroy(Semaphore *semaphore)
Definition: gw-semaphore.c:104
EventQueue * eq
Definition: test_smsc.c:267
void semaphore_down(Semaphore *semaphore)
Definition: gw-semaphore.c:132
Semaphore * sema
Definition: test_smsc.c:266
#define gwthread_create(func, arg)
Definition: gwthread.h:90
static void smpp_emu(void *arg)
Definition: test_smsc.c:433
#define panic
Definition: log.h:87
static long smpp_emu_id
Definition: test_smsc.c:499
Semaphore * semaphore_create(long n)
Definition: gw-semaphore.c:81

◆ smsc_emu_deliver()

static void smsc_emu_deliver ( void  )
static

Definition at line 532 of file test_smsc.c.

References eq_append(), eq_create_event(), and undelivered_messages.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

533 {
535 }
static void eq_append(EventQueue *eq, Event *e)
Definition: test_smsc.c:219
static Event * eq_create_event(enum event_type type)
Definition: test_smsc.c:142
static EventQueue * undelivered_messages
Definition: test_smsc.c:271

◆ smsc_emu_destroy()

static void smsc_emu_destroy ( void  )
static

Definition at line 523 of file test_smsc.c.

References eq_remove_producer(), gw_assert(), gwthread_join(), gwthread_wakeup(), smpp_emu_id, and undelivered_messages.

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

524 {
526  gw_assert(smpp_emu_id != -1);
529 }
gw_assert(wtls_machine->packet_to_send !=NULL)
void gwthread_join(long thread)
static void eq_remove_producer(EventQueue *eq)
Definition: test_smsc.c:207
static EventQueue * undelivered_messages
Definition: test_smsc.c:271
void gwthread_wakeup(long thread)
static long smpp_emu_id
Definition: test_smsc.c:499

◆ smsc_emu_init()

static void smsc_emu_init ( void  )
static

Definition at line 551 of file test_smsc.c.

References counter_create(), eq_add_producer(), eq_create(), smpp_emu_counter, and undelivered_messages.

Referenced by main().

552 {
556 }
static Counter * smpp_emu_counter
Definition: test_smsc.c:293
static void eq_add_producer(EventQueue *eq)
Definition: test_smsc.c:201
Counter * counter_create(void)
Definition: counter.c:94
static EventQueue * eq_create(void)
Definition: test_smsc.c:195
static EventQueue * undelivered_messages
Definition: test_smsc.c:271

◆ smsc_emu_shutdown()

static void smsc_emu_shutdown ( void  )
static

Definition at line 559 of file test_smsc.c.

References counter_destroy(), eq_destroy(), smpp_emu_counter, and undelivered_messages.

Referenced by main().

560 {
563 }
void counter_destroy(Counter *counter)
Definition: counter.c:110
static Counter * smpp_emu_counter
Definition: test_smsc.c:293
static EventQueue * undelivered_messages
Definition: test_smsc.c:271
static void eq_destroy(EventQueue *eq)
Definition: test_smsc.c:213

◆ smsc_emu_submit_ack()

static void smsc_emu_submit_ack ( Event e)
static

Definition at line 538 of file test_smsc.c.

References Event::conn, conn_write(), octstr_destroy(), Event::sequence_number, smpp_pdu_create(), smpp_pdu_destroy(), and smpp_pdu_pack().

Referenced by n_messages_benchmark(), and sustained_level_benchmark().

539 {
540  SMPP_PDU *resp;
541  Octstr *os;
542 
543  resp = smpp_pdu_create(submit_sm_resp, e->sequence_number);
544  os = smpp_pdu_pack(NULL, resp);
545  conn_write(e->conn, os);
546  octstr_destroy(os);
547  smpp_pdu_destroy(resp);
548 }
void smpp_pdu_destroy(SMPP_PDU *pdu)
Definition: smpp_pdu.c:434
int conn_write(Connection *conn, Octstr *data)
Definition: conn.c:1051
Octstr * smpp_pdu_pack(Octstr *smsc_id, SMPP_PDU *pdu)
Definition: smpp_pdu.c:458
long sequence_number
Definition: test_smsc.c:114
void octstr_destroy(Octstr *ostr)
Definition: octstr.c:324
Definition: octstr.c:118
Connection * conn
Definition: test_smsc.c:113
SMPP_PDU * smpp_pdu_create(unsigned long type, unsigned long seq_no)
Definition: smpp_pdu.c:400

◆ sustained_level_benchmark()

static void sustained_level_benchmark ( void  )
static

Definition at line 724 of file test_smsc.c.

References debug(), httpd_emu_arg::eq, eq_create(), eq_destroy(), eq_destroy_event(), eq_extract(), eq_log(), eq_round_trip_time(), eq_type(), httpd_emu_create(), httpd_emu_destroy(), httpd_emu_reply(), kill_kannel(), MAX_IN_AVERAGE, MAX_RTT, MAX_WAITING, num_messages, smsc_emu_create(), smsc_emu_deliver(), smsc_emu_destroy(), smsc_emu_submit_ack(), and Event::type.

Referenced by main().

725 {
726  EventQueue *eq;
727  Event *e;
728  long i;
729  long num_deliver;
730  long num_submit;
731  long rtt;
732  long times[MAX_IN_AVERAGE];
733  long next_time;
734  double time_sum;
735  long num_unanswered;
736 
737  eq = eq_create();
738 
741 
742  /* Wait for an SMS center client to appear. */
743  while ((e = eq_extract(eq)) != NULL && e->type != got_smsc)
744  debug("test_smsc", 0, "Discarding event of type %s", eq_type(e));
745  debug("test_smsc", 0, "Got event got_smsc.");
746  eq_destroy_event(e);
747 
748  /*
749  * Send message when there are at most MAX_WAITING unanswered messages
750  * and current average round trip time is less than MAX_RTT.
751  */
752  num_submit = 0;
753  for (i = 0; i < MAX_IN_AVERAGE; ++i)
754  times[i] = 0;
755  next_time = 0;
756  time_sum = 0.0;
757  num_unanswered = 0;
758  num_deliver = 0;
759 
760  while (num_submit < num_messages) {
761  for (;;) {
762  if (num_deliver >= num_messages || num_unanswered >= MAX_WAITING)
763  break;
764  if (time_sum / MAX_IN_AVERAGE >= MAX_RTT && num_unanswered > 0)
765  break;
767  ++num_unanswered;
768  ++num_deliver;
769  }
770 
771  e = eq_extract(eq);
772  if (e == NULL)
773  break;
774  eq_log(e);
775 
776  switch (e->type) {
777  case deliver_ack:
778  break;
779 
780  case http_request:
781  httpd_emu_reply(e);
782  break;
783 
784  case submit:
785  rtt = eq_round_trip_time(e);
786  time_sum -= times[next_time];
787  times[next_time] = rtt;
788  time_sum += times[next_time];
789  debug("", 0, "RTT = %ld", rtt);
790  next_time = (next_time + 1) % MAX_IN_AVERAGE;
791  ++num_submit;
792  --num_unanswered;
794  break;
795 
796  case got_enquire_link:
797  break;
798 
799  default:
800  debug("test_smsc", 0, "Ignoring event of type %s", eq_type(e));
801  break;
802  }
803 
804  eq_destroy_event(e);
805  }
806 
807  kill_kannel();
808 
809  debug("test_smsc", 0, "Terminating benchmark.");
812  eq_destroy(eq);
813 }
static long num_messages
Definition: test_smsc.c:90
static Event * eq_extract(EventQueue *eq)
Definition: test_smsc.c:225
static void eq_log(Event *e)
Definition: test_smsc.c:231
static void eq_destroy_event(Event *e)
Definition: test_smsc.c:188
EventQueue * eq
Definition: test_smsc.c:267
static void httpd_emu_destroy(void)
Definition: test_smsc.c:655
static void smsc_emu_deliver(void)
Definition: test_smsc.c:532
static void httpd_emu_create(EventQueue *eq)
Definition: test_smsc.c:630
static void smsc_emu_destroy(void)
Definition: test_smsc.c:523
static EventQueue * eq_create(void)
Definition: test_smsc.c:195
static void smsc_emu_submit_ack(Event *e)
Definition: test_smsc.c:538
static const char * eq_type(Event *e)
Definition: test_smsc.c:125
static void kill_kannel(void)
Definition: test_smsc.c:691
static void smsc_emu_create(EventQueue *eq)
Definition: test_smsc.c:505
enum Event::event_type type
void debug(const char *place, int err, const char *fmt,...)
Definition: log.c:726
static void httpd_emu_reply(Event *e)
Definition: test_smsc.c:667
static void eq_destroy(EventQueue *eq)
Definition: test_smsc.c:213
Definition: list.c:102
static long eq_round_trip_time(Event *e)
Definition: test_smsc.c:249

Variable Documentation

◆ admin_password

char* admin_password = "bar"
static

Definition at line 77 of file test_smsc.c.

Referenced by kill_kannel().

◆ admin_port

long admin_port = 13000
static

Definition at line 76 of file test_smsc.c.

Referenced by kill_kannel().

◆ event_id_counter

Counter* event_id_counter = NULL
static

Definition at line 122 of file test_smsc.c.

Referenced by eq_create_event(), eq_init(), and eq_shutdown().

◆ http_port

long http_port = 8080
static

Definition at line 70 of file test_smsc.c.

Referenced by httpd_emu_create().

◆ httpd_emu_headers

List* httpd_emu_headers = NULL
static

Definition at line 571 of file test_smsc.c.

Referenced by httpd_emu_init(), httpd_emu_reply(), and httpd_emu_shutdown().

◆ httpd_emu_tid

long httpd_emu_tid = -1
static

Definition at line 623 of file test_smsc.c.

Referenced by httpd_emu_create(), and httpd_emu_destroy().

◆ num_messages

long num_messages = 1
static

◆ smpp_emu_counter

Counter* smpp_emu_counter = NULL
static

Definition at line 293 of file test_smsc.c.

Referenced by smpp_emu_writer(), smsc_emu_init(), and smsc_emu_shutdown().

◆ smpp_emu_id

long smpp_emu_id = -1
static

Definition at line 499 of file test_smsc.c.

Referenced by smsc_emu_create(), and smsc_emu_destroy().

◆ smpp_port

long smpp_port = 2345
static

Definition at line 83 of file test_smsc.c.

Referenced by smpp_emu().

◆ undelivered_messages

EventQueue* undelivered_messages = NULL
static
See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.