blob: 500fbc35a8fd6f780806505c54b1306fcfc43384 [file] [log] [blame]
Harald Weltef1033cc2012-11-08 16:14:37 +01001#ifndef _SMPP_SMSC_H
2#define _SMPP_SMSC_H
3
4#include <sys/socket.h>
5#include <netinet/in.h>
6
7#include <osmocom/core/utils.h>
8#include <osmocom/core/msgb.h>
9#include <osmocom/core/write_queue.h>
10
11#include <smpp34.h>
12#include <smpp34_structs.h>
13#include <smpp34_params.h>
14
15enum esme_read_state {
16 READ_ST_IN_LEN = 0,
17 READ_ST_IN_MSG = 1,
18};
19
20struct osmo_esme {
21 struct llist_head list;
22 struct smsc *smsc;
23
24 struct osmo_wqueue wqueue;
25 struct sockaddr_storage sa;
26 socklen_t sa_len;
27
28 enum esme_read_state read_state;
29 uint32_t read_len;
30 uint32_t read_idx;
31 struct msgb *read_msg;
32
33 uint8_t smpp_version;
34 char system_id[16+1];
35
36 uint8_t bind_flags;
37};
38
39struct smsc {
40 struct osmo_fd listen_ofd;
41 struct llist_head esme_list;
42 char system_id[16+1];
43 void *priv;
44};
45
46
47int smpp_smsc_init(struct smsc *smsc, uint16_t port);
48
49int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
50 struct submit_sm_resp_t *submit_r);
51
52#endif