Kannel: Open Source WAP and SMS gateway
svn-r5336
|
#include <errno.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <termios.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <netinet/in.h>
#include <netdb.h>
#include "gwlib/gwlib.h"
#include "smsc.h"
#include "smsc_p.h"
#include "alt_charsets.h"
#include "smsc_sema.h"
#include "sms.h"
Go to the source code of this file.
Macros | |
#define | CRTSCTS 0 |
Functions | |
SMSCenter * | sema_open (char *smscnua, char *homenua, char *serialdevice, int waitreport) |
int | sema_reopen (SMSCenter *smsc) |
int | sema_close (SMSCenter *smsc) |
int | sema_submit_msg (SMSCenter *smsc, Msg *msg) |
int | sema_receive_msg (SMSCenter *smsc, Msg **msg) |
int | sema_pending_smsmessage (SMSCenter *smsc) |
static sema_msg * | sema_msg_new (void) |
static int | sema_msg_free (sema_msg *msg) |
static sema_msglist * | sema_msglist_new (void) |
static void | sema_msglist_free (sema_msglist *mlist) |
static int | sema_msglist_push (sema_msglist *plist, sema_msg *pmsg) |
static int | sema_msglist_pop (sema_msglist *plist, sema_msg **msg) |
static int | X28_open_data_link (char *device) |
static int | X28_reopen_data_link (int oldpadfd, char *device) |
static int | X28_close_send_link (int padfd) |
static int | X28_open_send_link (int padfd, char *nua) |
static int | X28_data_read (int padfd, char *cbuffer) |
static int | X28_data_send (int padfd, char *cbuffer, int sentonce) |
static int | X28_msg_pop (char *from, char *to) |
static int | sema_submit_result (SMSCenter *smsc, sema_msg *srcmsg, int result) |
static int | sema_msg_session_mt (SMSCenter *smsc, sema_msg *pmsg) |
static int | sema_msg_session_mo (SMSCenter *smsc, char *cbuff) |
static int | sema_decode_msg (sema_msg **desmsg, char *octsrc) |
static int | sema_encode_msg (sema_msg *pmsg, char *str) |
static int | line_scan_hex_GSM7 (unsigned char *from, int octects, int spetets, unsigned char *to) |
static int | line_append_hex_IA5 (Octstr *des, unsigned char *src, int len) |
static int | line_scan_IA5_hex (char *from, int hexnum, unsigned char *to) |
static unsigned char | internal_char_hex_to_gsm (unsigned char from) |
static int | internal_char_hex_to_IA5 (unsigned char from, unsigned char *to) |
static int | internal_char_IA5_to_hex (char *from, unsigned char *to) |
static void | increment_counter (void) |
static unsigned char | pack_continous_byte (int encode, int isfirst, int follownum) |
static int | unpack_continous_byte (unsigned char continueCount, int *encode, int *isfirst, int *follownum) |
Variables | |
static unsigned char | sema_counter [4] = "0000" |
static int | sema_wait_report = 1 |
static int | x28_data_mode = X28_COMMAND_MODE |
#define CRTSCTS 0 |
Definition at line 105 of file smsc_sema.c.
Referenced by X28_open_data_link().
|
static |
Definition at line 1858 of file smsc_sema.c.
References sema_counter.
Referenced by sema_submit_msg().
|
static |
|
static |
Definition at line 1730 of file smsc_sema.c.
References from.
Referenced by line_append_hex_IA5(), sema_encode_msg(), and sema_submit_result().
|
static |
Definition at line 1795 of file smsc_sema.c.
References from.
Referenced by line_scan_IA5_hex(), and sema_decode_msg().
|
static |
Definition at line 1634 of file smsc_sema.c.
References internal_char_hex_to_IA5(), octstr_insert_data(), and octstr_len().
Referenced by sema_encode_msg().
|
static |
Definition at line 1569 of file smsc_sema.c.
References from, and internal_char_hex_to_gsm().
Referenced by sema_decode_msg().
|
static |
Definition at line 1656 of file smsc_sema.c.
References from, and internal_char_IA5_to_hex().
Referenced by sema_decode_msg().
|
static |
int sema_close | ( | SMSCenter * | smsc | ) |
Definition at line 199 of file smsc_sema.c.
References SMSCenter::sema_fd, SMSCenter::sema_mo, sema_msglist_free(), and SMSCenter::sema_mt.
Referenced by smsc_close().
|
static |
Definition at line 1232 of file smsc_sema.c.
References sm_statusreport_invoke::accepttime, sm_submit_result::accepttime, sm_deliver_invoke::accepttime, sm_statusreport_invoke::completetime, sm_deliver_invoke::DCS, sm_deliver_invoke::destadd, sm_deliver_invoke::destaddlen, ENCODE_GSM, ENCODE_IA5, sm_statusreport_invoke::failreason, get_variable_value(), info(), sm_statusreport_invoke::intermediatime, internal_char_IA5_to_hex(), sm_statusreport_invoke::invoketime, sm_deliver_invoke::invoketime, line_scan_hex_GSM7(), line_scan_IA5_hex(), sm_statusreport_invoke::msisdn, sm_statusreport_invoke::msisdnlen, octstr_create, octstr_create_from_data, sm_statusreport_invoke::origadd, sm_deliver_invoke::origadd, sm_statusreport_invoke::origaddlen, sm_deliver_invoke::origaddlen, sm_deliver_invoke::protocal, sm_deliver_invoke::replypath, sm_deliver_invoke::shortmsg, SM_RESULT_SUCCESS, sm_statusreport_invoke::smerefnum, sm_submit_result::smeresult, sm_statusreport_invoke::smetype, sm_statusreport_invoke::smscrefnum, sm_submit_result::smscrefnum, sm_deliver_invoke::smscrefnum, sm_statusreport_invoke::status, sm_deliver_invoke::textsizeoctect, sm_deliver_invoke::textsizeseptet, and unpack_continous_byte().
Referenced by sema_msg_session_mo(), and sema_msg_session_mt().
|
static |
Definition at line 1512 of file smsc_sema.c.
References sm_submit_invoke::DCS, internal_char_hex_to_IA5(), line_append_hex_IA5(), sema_msg::msgbody, sm_submit_invoke::msisdn, sm_submit_invoke::msisdnlen, octstr_create, octstr_destroy(), octstr_get_cstr, octstr_insert_data(), octstr_len(), sm_submit_invoke::origadd, sm_submit_invoke::origaddlen, sm_submit_invoke::priority, sm_submit_invoke::protocal, sm_submit_invoke::replypath, sm_submit_invoke::shortmsg, sm_submit_invoke::smerefnum, sm_submit_invoke::smereftype, sm_submit_invoke::statusreportrequest, sm_submit_invoke::textsizeoctect, sm_submit_invoke::textsizeseptet, sema_msg::type, sm_submit_invoke::validperiodrela, sm_submit_invoke::validperiodtype, and write_variable_value().
Referenced by sema_msg_session_mt().
|
static |
Definition at line 422 of file smsc_sema.c.
References msg.
Referenced by sema_msg_session_mo(), sema_msg_session_mt(), sema_msglist_free(), sema_receive_msg(), and sema_submit_msg().
|
static |
Definition at line 414 of file smsc_sema.c.
References msg.
Referenced by sema_msg_session_mo(), sema_msg_session_mt(), and sema_submit_msg().
|
static |
Definition at line 1173 of file smsc_sema.c.
References error(), info(), sema_msg::msgbody, sema_decode_msg(), SMSCenter::sema_fd, SMSCenter::sema_mo, sema_msg_free(), sema_msg_new(), sema_msglist_push(), SMSCenter::sema_smscnua, sema_submit_result(), sema_msg::type, X28_close_send_link(), X28_COMMAND_MODE, x28_data_mode, and X28_open_send_link().
Referenced by sema_pending_smsmessage().
Definition at line 940 of file smsc_sema.c.
References SMSCenter::buffer, msg_hash::content, debug(), sema_msg::encodetype, error(), info(), INTERNAL_SESSION_MT_TIMEVAL, sema_msg::msgbody, octstr_create_from_data, octstr_destroy(), octstr_get_cstr, octstr_insert_data(), octstr_len(), sema_msg::optref, pack_continous_byte(), sema_decode_msg(), sema_encode_msg(), SMSCenter::sema_fd, sema_msg_free(), sema_msg_new(), SMSCenter::sema_serialdevice, SMSCenter::sema_smscnua, sema_submit_result(), sema_wait_report, SESSION_MT_RECEIVE_ERR, SESSION_MT_RECEIVE_SUCCESS, SESSION_MT_RECEIVE_TIMEOUT, sm_submit_result::smeresult, sm_statusreport_invoke::smscrefnum, sm_submit_result::smscrefnum, sm_submit_invoke::smscrefnum, sm_statusreport_invoke::status, sema_msg::type, X28_close_send_link(), x28_data_mode, X28_data_read(), X28_data_send(), X28_msg_pop(), X28_MT_DATA_MODE, X28_open_send_link(), and X28_reopen_data_link().
Referenced by sema_submit_msg().
|
static |
Definition at line 440 of file smsc_sema.c.
References sema_msglist::count, sema_msg_free(), and sema_msglist_pop().
Referenced by sema_close(), and sema_reopen().
|
static |
Definition at line 428 of file smsc_sema.c.
References sema_msglist::count, sema_msglist::first, and sema_msglist::last.
Referenced by sema_open(), and sema_reopen().
|
static |
Definition at line 487 of file smsc_sema.c.
References sema_msglist::count, sema_msglist::first, info(), sema_msglist::last, msg, sema_msg::next, and sema_msg::prev.
Referenced by sema_msglist_free(), and sema_receive_msg().
|
static |
Definition at line 453 of file smsc_sema.c.
References sema_msglist::count, error(), sema_msglist::first, info(), sema_msglist::last, sema_msg::next, and sema_msg::prev.
Referenced by sema_msg_session_mo().
SMSCenter* sema_open | ( | char * | smscnua, |
char * | homenua, | ||
char * | serialdevice, | ||
int | waitreport | ||
) |
Definition at line 113 of file smsc_sema.c.
References debug(), error(), SMSCenter::name, SMSCenter::sema_fd, SMSCenter::sema_homenua, SMSCenter::sema_mo, sema_msglist_new(), SMSCenter::sema_mt, SMSCenter::sema_serialdevice, SMSCenter::sema_smscnua, sema_wait_report, SMSC_TYPE_SEMA_X28, smscenter_construct(), smscenter_destruct(), SMSCenter::type, X28_close_send_link(), X28_open_data_link(), and X28_open_send_link().
Referenced by smsc_open().
int sema_pending_smsmessage | ( | SMSCenter * | smsc | ) |
Definition at line 365 of file smsc_sema.c.
References SMSCenter::buffer, debug(), error(), sema_msglist::first, SMSCenter::sema_fd, SMSCenter::sema_mo, sema_msg_session_mo(), SMSCenter::sema_serialdevice, X28_data_read(), X28_msg_pop(), and X28_reopen_data_link().
Referenced by smscenter_pending_smsmessage().
Definition at line 323 of file smsc_sema.c.
References DC_8BIT, sm_deliver_invoke::destadd, error(), msg, msg_create, sema_msg::msgbody, octstr_create, octstr_create_from_data, octstr_duplicate, octstr_get_cstr, octstr_len(), sm_deliver_invoke::origadd, SMSCenter::sema_mo, sema_msg_free(), sema_msglist_pop(), and sm_deliver_invoke::shortmsg.
Referenced by smscenter_receive_msg().
int sema_reopen | ( | SMSCenter * | smsc | ) |
Definition at line 162 of file smsc_sema.c.
References SMSCenter::buffer, debug(), error(), SMSCenter::sema_fd, SMSCenter::sema_mo, sema_msglist_free(), sema_msglist_new(), SMSCenter::sema_mt, SMSCenter::sema_serialdevice, SMSCenter::sema_smscnua, X28_close_send_link(), X28_open_send_link(), and X28_reopen_data_link().
Referenced by smsc_reopen().
Definition at line 210 of file smsc_sema.c.
References sm_submit_invoke::DCS, debug(), sema_msg::encodetype, error(), increment_counter(), info(), LINE_ENCODE_IA5, msg, sema_msg::msgbody, sm_submit_invoke::msisdn, sm_submit_invoke::msisdnlen, octstr_copy, octstr_create_from_data, octstr_len(), sema_msg::optref, sm_submit_invoke::origadd, sm_submit_invoke::origaddlen, sm_submit_invoke::priority, sm_submit_invoke::protocal, sm_submit_invoke::replypath, sema_counter, sema_msg_free(), sema_msg_new(), sema_msg_session_mt(), sema_wait_report, SESSION_MT_RECEIVE_ERR, SESSION_MT_RECEIVE_SUCCESS, SESSION_MT_RECEIVE_TIMEOUT, sm_submit_invoke::shortmsg, sm_submit_invoke::smerefnum, sm_submit_invoke::smereftype, sm_submit_invoke::smscrefnum, sm_submit_invoke::statusreportrequest, sm_submit_invoke::textsizeoctect, sm_submit_invoke::textsizeseptet, sema_msg::type, sm_submit_invoke::validperiodrela, and sm_submit_invoke::validperiodtype.
Referenced by smscenter_submit_msg().
Definition at line 896 of file smsc_sema.c.
References error(), internal_char_hex_to_IA5(), sema_msg::optref, SMSCenter::sema_fd, sema_msg::type, write_variable_value(), and X28_data_send().
Referenced by sema_msg_session_mo(), and sema_msg_session_mt().
|
static |
Definition at line 1915 of file smsc_sema.c.
References LINE_ENCODE_BIN, LINE_ENCODE_HEX, and LINE_ENCODE_IA5.
Referenced by sema_decode_msg().
|
static |
Definition at line 564 of file smsc_sema.c.
References error(), INTERNAL_DISCONNECT_TIMEVAL, X28_COMMAND_MODE, and x28_data_mode.
Referenced by sema_msg_session_mo(), sema_msg_session_mt(), sema_open(), and sema_reopen().
|
static |
Definition at line 713 of file smsc_sema.c.
References error().
Referenced by sema_msg_session_mt(), and sema_pending_smsmessage().
|
static |
Definition at line 771 of file smsc_sema.c.
References error().
Referenced by sema_msg_session_mt(), and sema_submit_result().
|
static |
Definition at line 804 of file smsc_sema.c.
References from, X28_COMMAND_MODE, x28_data_mode, and X28_MO_DATA_MODE.
Referenced by sema_msg_session_mt(), and sema_pending_smsmessage().
|
static |
Definition at line 518 of file smsc_sema.c.
References CRTSCTS, error(), info(), and kannel_cfmakeraw().
Referenced by sema_open(), and X28_reopen_data_link().
|
static |
Definition at line 611 of file smsc_sema.c.
References debug(), error(), info(), INTERNAL_CONNECT_TIMEVAL, warning(), x28_data_mode, and X28_MT_DATA_MODE.
Referenced by sema_msg_session_mo(), sema_msg_session_mt(), sema_open(), and sema_reopen().
|
static |
Definition at line 551 of file smsc_sema.c.
References error(), and X28_open_data_link().
Referenced by sema_msg_session_mt(), sema_pending_smsmessage(), and sema_reopen().
|
static |
Definition at line 109 of file smsc_sema.c.
Referenced by increment_counter(), and sema_submit_msg().
|
static |
Definition at line 110 of file smsc_sema.c.
Referenced by sema_msg_session_mt(), sema_open(), and sema_submit_msg().
|
static |
Definition at line 111 of file smsc_sema.c.
Referenced by sema_msg_session_mo(), sema_msg_session_mt(), X28_close_send_link(), X28_msg_pop(), and X28_open_send_link().