Main Page | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

msg.h File Reference

#include "gwlib/gwlib.h"
#include "msg-decl.h"

Include dependency graph for msg.h:

Include dependency graph

This graph shows which files directly or indirectly include this file:

Included by dependency graph

Go to the source code of this file.

Data Structures

struct  Msg
struct  split_parts

Defines

#define MSG_PARAM_UNDEFINED   -1
#define MSG(type, stmt)   type,
#define INTEGER(name)   long name
#define OCTSTR(name)   Octstr *name
#define UUID(name)   uuid_t name
#define VOID(name)   void *name
#define MSG(type, stmt)   struct type stmt type;
#define msg_create(type)   gw_claim_area(msg_create_real((type), __FILE__, __LINE__, __func__))
#define msg_unpack(os)   gw_claim_area(msg_unpack_real((os), __FILE__, __LINE__, __func__))

Enumerations

enum  msg_type {
  type, heartbeat, admin, sms,
  ack, wdp_datagram, msg_type_count
}
enum  {
  mo = 0, mt_reply = 1, mt_push = 2, report_mo = 3,
  report_mt = 4
}
enum  {
  cmd_shutdown = 0, cmd_suspend = 1, cmd_resume = 2, cmd_identify = 3,
  cmd_restart = 4
}
enum  ack_status_t { ack_success = 0, ack_failed = 1, ack_failed_tmp = 2, ack_buffered = 3 }

Functions

Msgmsg_create_real (enum msg_type type, const char *file, long line, const char *func)
Msgmsg_duplicate (Msg *msg)
enum msg_type msg_type (Msg *msg)
void msg_destroy (Msg *msg)
void msg_destroy_item (void *msg)
void msg_dump (Msg *msg, int level)
Octstrmsg_pack (Msg *msg)
Msgmsg_unpack_real (Octstr *os, const char *file, long line, const char *func)
Msgmsg_unpack_wrapper (Octstr *os)


Define Documentation

#define INTEGER name   )     long name
 

Definition at line 82 of file msg.h.

#define MSG type,
stmt   )     struct type stmt type;
 

Definition at line 86 of file msg.h.

#define MSG type,
stmt   )     type,
 

Definition at line 86 of file msg.h.

#define msg_create type   )     gw_claim_area(msg_create_real((type), __FILE__, __LINE__, __func__))
 

Definition at line 130 of file msg.h.

Referenced by at2_pdu_decode_deliver_sm(), boxc_receiver(), boxc_sender(), brunet_receive_sms(), cgw_handle_op(), cimd2_accept_message(), cimd_receive_msg(), clickatell_receive_sms(), create_dlr_from_msg(), data_sm_to_msg(), deliver_sms_to_queue(), dlr_find(), handle_operation(), heartbeat_thread(), identify_to_bearerbox(), kannel_receive_sms(), main(), msg_duplicate(), msg_to_bb(), obey_request_thread(), ois_deliver_sm_invoke(), oisd_accept_message(), ota_pack_message(), ota_tokenize_bookmarks(), ota_tokenize_settings(), pack_ip_datagram(), pack_sms_datagram(), parse_rawmessage_to_msg(), pdu_to_msg(), remember_receiver(), run_batch(), run_connects(), sema_receive_msg(), smsbox_req_handle(), smsbox_thread(), soap_parse_mo(), store_file_save_ack(), store_spool_save_ack(), udp_receiver(), wdp_create(), and xidris_receive_sms().

#define MSG_PARAM_UNDEFINED   -1
 

Definition at line 71 of file msg.h.

#define msg_unpack os   )     gw_claim_area(msg_unpack_real((os), __FILE__, __LINE__, __func__))
 

Definition at line 177 of file msg.h.

Referenced by main(), msg_unpack_wrapper(), read_from_bearerbox_real(), run_requests(), and smsbox_thread().

#define OCTSTR name   )     Octstr *name
 

Definition at line 83 of file msg.h.

#define UUID name   )     uuid_t name
 

Definition at line 84 of file msg.h.

#define VOID name   )     void *name
 

Definition at line 85 of file msg.h.


Enumeration Type Documentation

anonymous enum
 

Enumeration values:
mo 
mt_reply 
mt_push 
report_mo 
report_mt 

Definition at line 100 of file msg.h.

00100      {
00101     mo = 0,
00102     mt_reply = 1,
00103     mt_push = 2,
00104     report_mo = 3,
00105     report_mt = 4
00106 };

anonymous enum
 

Enumeration values:
cmd_shutdown 
cmd_suspend 
cmd_resume 
cmd_identify 
cmd_restart 

Definition at line 109 of file msg.h.

00109      {
00110     cmd_shutdown = 0,
00111     cmd_suspend = 1,
00112     cmd_resume = 2,
00113     cmd_identify = 3,
00114     cmd_restart = 4
00115 };

enum ack_status_t
 

Enumeration values:
ack_success 
ack_failed 
ack_failed_tmp 
ack_buffered 

Definition at line 118 of file msg.h.

00118              {
00119     ack_success = 0,
00120     ack_failed = 1,     /* do not try again (e.g. no route) */
00121     ack_failed_tmp = 2, /* temporary failed, try again (e.g. queue full) */
00122     ack_buffered = 3
00123 } ack_status_t;

enum msg_type
 

Enumeration values:
type 
heartbeat 
admin 
sms 
ack 
wdp_datagram 
msg_type_count 

Definition at line 73 of file msg.h.

Referenced by at2_send_one_message(), bb_alog_sms(), boxc_receiver(), boxc_sender(), boxc_sent_pop(), boxc_sent_push(), dispatch_into_queue(), main(), obey_request(), ois_submit_msg(), read_messages_from_bearerbox(), route_incoming_to_boxc(), sema_submit_msg(), send_message(), service_router(), sms_priority_compare(), sms_to_smsboxes(), smsc2_rout(), smscconn_usable(), smscenter_receive_msg(), store_file_load(), store_file_save_ack(), store_file_status(), store_spool_save(), store_to_dict(), udp_addwdp(), udp_addwdp_from_client(), udp_addwdp_from_server(), wdp_msg2event(), wdp_router(), and wdp_to_wapboxes().

00073               {
00074     #define MSG(type, stmt) type,
00075     #include "msg-decl.h"
00076     msg_type_count
00077 };


Function Documentation

Msg* msg_create_real enum msg_type  type,
const char *  file,
long  line,
const char *  func
 

Definition at line 93 of file msg.c.

References file.

Referenced by msg_unpack_real().

00095 {
00096     Msg *msg;
00097 
00098     msg = gw_malloc_trace(sizeof(Msg), file, line, func);
00099 
00100     msg->type = type;
00101 #define INTEGER(name) p->name = MSG_PARAM_UNDEFINED
00102 #define OCTSTR(name) p->name = NULL
00103 #define UUID(name) uuid_generate(p->name)
00104 #define VOID(name) p->name = NULL
00105 #define MSG(type, stmt) { struct type *p = &msg->type; stmt }
00106 #include "msg-decl.h"
00107 
00108     return msg;
00109 }

void msg_destroy Msg msg  ) 
 

Definition at line 132 of file msg.c.

Referenced by bb_smscconn_receive(), bb_smscconn_send_failed(), bb_smscconn_sent(), boxc_receiver(), boxc_sender(), boxc_sent_pop(), check_concatenation(), cimd2_accept_message(), clear_old_concat_parts(), data_sm_to_msg(), deliver_sms_to_queue(), deliver_to_bearerbox_real(), destroy_concatMsg(), dispatch_datagram(), emi_receive_msg(), empty_msg_lists(), handle_pdu(), handle_split(), http_queue_thread(), main(), main_connection_loop(), msg_destroy_item(), msg_to_bb(), msg_unpack_real(), obey_request_thread(), ois_deliver_sm_invoke(), oisd_accept_message(), pdu_to_msg(), read_messages_from_bearerbox(), run_batch(), run_requests(), send_message(), send_pdu(), smpp_msg_destroy(), sms_receive(), sms_router(), sms_split(), smsbox_req_handle(), smsbox_req_sendota(), smsbox_sendota_post(), smsbox_thread(), smsc2_rout(), status_cb(), store_file_load(), store_file_save_ack(), store_spool_save_ack(), store_to_dict(), udp_sender(), url_result_thread(), wdp_to_wapboxes(), wrapper_sender(), and write_to_bearerbox_real().

00133 {
00134     if (msg == NULL)
00135         return;
00136 
00137 #define INTEGER(name) p->name = 0
00138 #define OCTSTR(name) octstr_destroy(p->name)
00139 #define UUID(name) uuid_clear(p->name)
00140 #define VOID(name)
00141 #define MSG(type, stmt) { struct type *p = &msg->type; stmt }
00142 #include "msg-decl.h"
00143 
00144     gw_free(msg);
00145 }

void msg_destroy_item void *  msg  ) 
 

Definition at line 147 of file msg.c.

References msg_destroy().

Referenced by cimd2_destroy(), empty_msg_lists(), oisd_destroy(), smasi_destroy(), smpp_destroy(), smscconn_send(), and store_file_init().

00148 {
00149     msg_destroy(msg);
00150 }

Here is the call graph for this function:

void msg_dump Msg msg,
int  level
 

Definition at line 152 of file msg.c.

References debug(), type_as_str(), and UUID_STR_LEN.

Referenced by boxc_sent_pop(), check_concatenation(), dump(), handle_pdu(), main(), obey_request_thread(), print_msg(), and store_file_load().

00153 {
00154     char buf[UUID_STR_LEN + 1];
00155 
00156     debug("gw.msg", 0, "%*sMsg object at %p:", level, "", (void *) msg);
00157     debug("gw.msg", 0, "%*s type: %s", level, "", type_as_str(msg));
00158 #define INTEGER(name) \
00159     debug("gw.msg", 0, "%*s %s.%s: %ld", level, "", t, #name, (long) p->name)
00160 #define OCTSTR(name) \
00161     debug("gw.msg", 0, "%*s %s.%s:", level, "", t, #name); \
00162     octstr_dump(p->name, level + 1)
00163 #define UUID(name) \
00164     uuid_unparse(p->name, buf); \
00165     debug("gw.msg", 0 , "%*s %s.%s: %s", level, "", t, #name, buf)
00166 #define VOID(name) \
00167      debug("gw.msg", 0, "%*s %s.%s: %p", level, "", t, #name, p->name)
00168 #define MSG(tt, stmt) \
00169     if (tt == msg->type) \
00170         { char *t = #tt; struct tt *p = &msg->tt; stmt }
00171 #include "msg-decl.h"
00172     debug("gw.msg", 0, "Msg object ends.");
00173 }

Here is the call graph for this function:

Msg* msg_duplicate Msg msg  ) 
 

Definition at line 111 of file msg.c.

References msg_create.

Referenced by add_msg_cb(), at2_add_msg_cb(), bb_smscconn_receive(), boxc_sent_push(), cgw_add_msg_cb(), check_concatenation(), cimd2_add_msg_cb(), clear_old_concat_parts(), httpsmsc_send(), main(), main_connection_loop(), oisd_add_msg_cb(), send_message(), send_msg_cb(), sms_split(), smsc2_rout(), smscconn_send(), soap_add_msg_cb(), store_to_dict(), wrapper_add_msg(), and wrapper_sender().

00112 {
00113     Msg *new;
00114 
00115     new = msg_create(msg->type);
00116 
00117 #define INTEGER(name) p->name = q->name
00118 #define OCTSTR(name) \
00119     if (q->name == NULL) p->name = NULL; \
00120     else p->name = octstr_duplicate(q->name);
00121 #define UUID(name) uuid_copy(p->name, q->name)
00122 #define VOID(name) p->name = q->name
00123 #define MSG(type, stmt) { \
00124     struct type *p = &new->type; \
00125     struct type *q = &msg->type; \
00126     stmt }
00127 #include "msg-decl.h"
00128 
00129     return new;
00130 }

Octstr* msg_pack Msg msg  ) 
 

Definition at line 181 of file msg.c.

References append_integer(), octstr_create, and panic.

Referenced by deliver_to_bearerbox_real(), init_bearerbox(), main(), send_msg(), send_pdu(), smsbox_thread(), and write_to_bearerbox_real().

00182 {
00183     Octstr *os;
00184 
00185     os = octstr_create("");
00186     append_integer(os, msg->type);
00187 
00188 #define INTEGER(name) append_integer(os, p->name)
00189 #define OCTSTR(name) append_string(os, p->name)
00190 #define UUID(name) append_uuid(os, p->name)
00191 #define VOID(name)
00192 #define MSG(type, stmt) \
00193     case type: { struct type *p = &msg->type; stmt } break;
00194 
00195     switch (msg->type) {
00196 #include "msg-decl.h"
00197     default:
00198         panic(0, "Internal error: unknown message type %d",
00199               msg->type);
00200     }
00201 
00202     return os;
00203 }

Here is the call graph for this function:

enum msg_type msg_type Msg msg  ) 
 

Definition at line 176 of file msg.c.

References msg_type().

Referenced by msg_type().

00177 {
00178     return msg->type;
00179 }

Here is the call graph for this function:

Msg* msg_unpack_real Octstr os,
const char *  file,
long  line,
const char *  func
 

Definition at line 206 of file msg.c.

References error(), file, msg_create_real(), msg_destroy(), panic, and parse_integer().

00207 {
00208     Msg *msg;
00209     int off;
00210     long i;
00211 
00212     msg = msg_create_real(0, file, line, func);
00213     if (msg == NULL)
00214         goto error;
00215 
00216     off = 0;
00217 
00218     if (parse_integer(&i, os, &off) == -1)
00219         goto error;
00220     msg->type = i;
00221 
00222 #define INTEGER(name) \
00223     if (parse_integer(&(p->name), os, &off) == -1) goto error
00224 #define OCTSTR(name) \
00225     if (parse_string(&(p->name), os, &off) == -1) goto error
00226 #define UUID(name) \
00227     if (parse_uuid(p->name, os, &off) == -1) goto error
00228 #define VOID(name)
00229 #define MSG(type, stmt) \
00230     case type: { struct type *p = &(msg->type); stmt } break;
00231 
00232     switch (msg->type) {
00233 #include "msg-decl.h"
00234     default:
00235         panic(0, "Internal error: unknown message type: %d",
00236               msg->type);
00237     }
00238 
00239     return msg;
00240 
00241 error:
00242     if (msg != NULL) msg_destroy(msg);
00243     error(0, "Msg packet was invalid.");
00244     return NULL;
00245 }

Here is the call graph for this function:

Msg* msg_unpack_wrapper Octstr os  )  [inline]
 

Definition at line 253 of file msg.c.

References msg_unpack.

Referenced by init_bearerbox(), and main().

00254 {
00255     return msg_unpack(os);
00256 }

See file LICENSE for details about the license agreement for using, modifying, copying or deriving work from this software.