Max | 5346f69 | 2022-07-28 14:19:22 +0700 | [diff] [blame] | 1 | #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 | |
| 9 | enum esme_read_state { |
| 10 | READ_ST_IN_LEN = 0, |
| 11 | READ_ST_IN_MSG = 1, |
| 12 | }; |
| 13 | |
Max | 62977d0 | 2022-08-01 22:50:52 +0700 | [diff] [blame^] | 14 | #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 | |
Max | 5346f69 | 2022-07-28 14:19:22 +0700 | [diff] [blame] | 20 | /*! \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 | |
| 35 | uint32_t smpp_msgb_cmdid(struct msgb *msg); |
| 36 | int smpp_openbsc_alloc_init(void *ctx); |
| 37 | int smpp_openbsc_start(struct gsm_network *net); |