blob: df5e163c06204190a16c77aa01df94dd24ccde9d [file] [log] [blame]
Max5346f692022-07-28 14:19:22 +07001#pragma once
2
3#include <osmocom/msc/gsm_data.h>
4
5/* Length limits according to SMPP 3.4 spec including NUL-byte: */
6#define SMPP_SYS_ID_LEN 15
7#define SMPP_PASSWD_LEN 8
8
9enum esme_read_state {
10 READ_ST_IN_LEN = 0,
11 READ_ST_IN_MSG = 1,
12};
13
Max62977d02022-08-01 22:50:52 +070014#define LOGPESME(ESME, LEVEL, FMT, ARGS...) \
15 LOGP(DSMPP, LEVEL, "[%s] " FMT, (ESME)->system_id, ##ARGS)
16
17#define LOGPESMERR(ESME, FMT, ARGS...) \
18 LOGPESME(ESME, LOGL_ERROR, "Error (%s) " FMT, smpp34_strerror, ##ARGS)
19
Max5346f692022-07-28 14:19:22 +070020/*! \brief Ugly wrapper. libsmpp34 should do this itself! */
21#define SMPP34_UNPACK(rc, type, str, data, len) { \
22 memset(str, 0, sizeof(*str)); \
23 rc = smpp34_unpack(type, str, data, len); }
24
25#define PACK_AND_SEND(esme, ptr) pack_and_send(esme, (ptr)->command_id, ptr)
26
27/*! \brief initialize the libsmpp34 data structure for a response */
28#define INIT_RESP(type, resp, req) { \
29 memset((resp), 0, sizeof(*(resp))); \
30 (resp)->command_length = 0; \
31 (resp)->command_id = type; \
32 (resp)->command_status = ESME_ROK; \
33 (resp)->sequence_number = (req)->sequence_number; }
34
35uint32_t smpp_msgb_cmdid(struct msgb *msg);
36int smpp_openbsc_alloc_init(void *ctx);
37int smpp_openbsc_start(struct gsm_network *net);