70     case  1: 
return "Checksum error";
    71     case  2: 
return "Syntax error";
    72     case  3: 
return "Operation not supported by system";
    73     case  4: 
return "Operation not allowed";
    74     case  5: 
return "Call barring active";
    75     case  6: 
return "AdC invalid";
    76     case  7: 
return "Authentication failure";
    77     case  8: 
return "Legitimisation code for all calls, failure";
    78     case  9: 
return "GA not valid";
    79     case 10: 
return "Repetition not allowed";
    80     case 11: 
return "Legitimisation code for repetition, failure";
    81     case 12: 
return "Priority call not allowed";
    82     case 13: 
return "Legitimisation code for priority call, failure";
    83     case 14: 
return "Urgent message not allowed";
    84     case 15: 
return "Legitimisation code for urgent message, failure";
    85     case 16: 
return "Reverse charging not allowed";
    86     case 17: 
return "Legitimisation code for reverse charging, failure";
    87     case 18: 
return "Deferred delivery not allowed";
    88     case 19: 
return "New AC not valid";
    89     case 20: 
return "New legitimisation code not valid";
    90     case 21: 
return "Standard text not valid";
    91     case 22: 
return "Time period not valid";
    92     case 23: 
return "Message type not supported by system";
    93     case 24: 
return "Message too long";
    94     case 25: 
return "Requested standard text not valid";
    95     case 26: 
return "Message type not valid for the pager type";
    96     case 27: 
return "Message not found in smsc";
    97     case 30: 
return "Subscriber hang-up";
    98     case 31: 
return "Fax group not supported";
    99     case 32: 
return "Fax message type not supported";
   100     case 33: 
return "Address already in list (60 series)";
   101     case 34: 
return "Address not in list (60 series)";
   102     case 35: 
return "List full, cannot add address to list (60 series)";
   103     case 36: 
return "RPID already in use";
   104     case 37: 
return "Delivery in progress";
   105     case 38: 
return "Message forwarded";
   106     default: 
return "!UNRECOGNIZED ERROR CODE!";
   125     error(0, 
"EMI2[%s]: Unsupported EMI operation request type %d", 
   136     return posit ? 2 : 3;
   138     return posit ? 2 : 3;
   144     return posit ? 2 : 3;
   146     error(0, 
"EMI2[%s]: Unsupported EMI operation reply type %d", 
   157     ret = gw_malloc(
sizeof(
struct emimsg));
   237     ret = gw_malloc(
sizeof(
struct emimsg));
   254     int end, i, checksum;
   260     for (i = 1; i < end; i++)
   262     return checksum & 0xff;
   270     char *hexits = 
"0123456789ABCDEF";
   292     long trn, len, 
ot, checksum; 
   294     long fieldno, pos, pos2;
   295     struct emimsg *result = NULL;
   297     debug(
"smsc.emi2", 0, 
"EMI2[%s]: emi2 parsing packet: <%s>",
   318     else if (posit == 
'N')
   326     for (fieldno = 0; fieldno < result->
num_fields; fieldno++) {
   342     warning(0, 
"get_fields: EMI message of type %d/%c has %d more fields "   343         "than expected.", result->
ot, result->
or, extrafields);
   353     error(0, 
"EMI2[%s]: Got negative ack. op:%d, trn:%d, error:%ld (%s), message:%s",
   374     error(0, 
"EMI2[%s]: emimsg_send: conversion to string failed",
   379     debug(
"smsc.emi2", 0, 
"EMI2[%s]: Sending operation type 60, message with "   382     debug(
"smsc.emi2", 0, 
"EMI2[%s]: emi2 sending packet: <%s>",
   386     error(0, 
"EMI2[%s]: emimsg_send: write failed",
 struct emimsg * emimsg_duplicate(struct emimsg *emimsg)
 
void error(int err, const char *fmt,...)
 
int emimsg_send(Connection *conn, struct emimsg *emimsg, Octstr *whoami)
 
void octstr_append(Octstr *ostr1, const Octstr *ostr2)
 
void emimsg_destroy(struct emimsg *emimsg)
 
static Octstr * emimsg_tostring(struct emimsg *emimsg)
 
void octstr_append_char(Octstr *ostr, int ch)
 
static int field_count_reply(int ot, int posit, Octstr *whoami)
 
struct emimsg * emimsg_create_op(int ot, int trn, Octstr *whoami)
 
struct emimsg * get_fields(Octstr *message, Octstr *whoami)
 
#define octstr_get_cstr(ostr)
 
#define octstr_copy(ostr, from, len)
 
long octstr_search_char(const Octstr *ostr, int ch, long pos)
 
static int calculate_checksum(Octstr *message)
 
int conn_write(Connection *conn, Octstr *data)
 
static struct emimsg * emimsg_create_withlen(int len)
 
#define octstr_duplicate(ostr)
 
struct emimsg * emimsg_create_reply(int ot, int trn, int positive, Octstr *whoami)
 
void warning(int err, const char *fmt,...)
 
Octstr * octstr_format(const char *fmt,...)
 
void octstr_destroy(Octstr *ostr)
 
#define octstr_create(cstr)
 
static char * emi_strerror(int errnum)
 
long octstr_len(const Octstr *ostr)
 
void debug(const char *place, int err, const char *fmt,...)
 
static int field_count_op(int ot, Octstr *whoami)
 
long octstr_parse_long(long *nump, Octstr *ostr, long pos, int base)
 
int octstr_get_char(const Octstr *ostr, long pos)
 
static struct emimsg * emimsg_create_reply_s(int ot, int trn, int positive, Octstr *whoami)