blob: e93ae30c240ad229e48c84dd6353ae2064d1f864 [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
Harald Weltee94db492012-11-08 20:11:05 +010024 int use;
25
Harald Weltef1033cc2012-11-08 16:14:37 +010026 struct osmo_wqueue wqueue;
27 struct sockaddr_storage sa;
28 socklen_t sa_len;
29
30 enum esme_read_state read_state;
31 uint32_t read_len;
32 uint32_t read_idx;
33 struct msgb *read_msg;
34
35 uint8_t smpp_version;
36 char system_id[16+1];
37
38 uint8_t bind_flags;
39};
40
41struct smsc {
42 struct osmo_fd listen_ofd;
43 struct llist_head esme_list;
44 char system_id[16+1];
45 void *priv;
46};
47
48
49int smpp_smsc_init(struct smsc *smsc, uint16_t port);
50
Harald Weltee94db492012-11-08 20:11:05 +010051void smpp_esme_get(struct osmo_esme *esme);
52void smpp_esme_put(struct osmo_esme *esme);
53
Harald Welted4bdee72012-11-08 19:44:08 +010054int smpp_tx_submit_r(struct osmo_esme *esme, uint32_t sequence_nr,
55 uint32_t command_status, char *msg_id);
56
Harald Weltef1033cc2012-11-08 16:14:37 +010057int handle_smpp_submit(struct osmo_esme *esme, struct submit_sm_t *submit,
58 struct submit_sm_resp_t *submit_r);
59
60#endif