/*
* create layer 3 message
*/
+#ifdef SOCKET_MISDN
+static struct l3_msg *create_l3msg(void)
+#else
static msg_t *create_l3msg(int prim, int mt, int dinfo, int size, int ntmode)
+#endif
{
+#ifdef SOCKET_MISDN
+ struct l3_msg *l3m;
+
+ l3m = alloc_l3_msg();
+ if (l3m)
+ return(l3m);
+#else
msg_t *dmsg;
Q931_info_t *qi;
iframe_t *frm;
return(dmsg);
}
}
+#endif
FATAL("Cannot allocate memory, system overloaded.\n");
exit(0); // make gcc happy
}
+#ifndef SOCKET_MISDN
msg_t *create_l2msg(int prim, int dinfo, int size) /* NT only */
{
msg_t *dmsg;
FATAL("Cannot allocate memory, system overloaded.\n");
exit(0); // make gcc happy
}
+#endif
/*
* if we received a first reply to the setup message,
int Pdss1::received_first_reply_to_setup(unsigned long prim, int channel, int exclusive)
{
int ret;
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
RELEASE_COMPLETE_t *release_complete;
msg_t *dmsg;
+#endif
/* correct exclusive to 0, if no explicit channel was given */
if (exclusive<0 || channel<=0)
return(0);
channelerror:
+ /*
+ * NOTE: we send MT_RELEASE_COMPLETE to "REJECT" the channel
+ * in response to the setup reply
+ */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, p_m_d_l3id, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE_COMPLETE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
return(-34); /* to epoint: no channel available */
/* CC_SETUP INDICATION */
void Pdss1::setup_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
SETUP_t *setup = (SETUP_t *)((unsigned long)data + headerlen);
+#endif
int calling_type, calling_plan, calling_present, calling_screen;
int called_type, called_plan;
int redir_type, redir_plan, redir_present, redir_screen, redir_reason;
int bearer_coding, bearer_capability, bearer_mode, bearer_rate, bearer_multi, bearer_user;
int exclusive, channel;
int ret;
- msg_t *dmsg;
unsigned char keypad[32] = "";
unsigned char useruser[128];
int useruser_len = 0, useruser_protocol;
dec_ie_bearer(setup->BEARER, (Q931_info_t *)((unsigned long)data+headerlen), &bearer_coding, &bearer_capability, &bearer_mode, &bearer_rate, &bearer_multi, &bearer_user);
end_trace();
- /* if blocked, release call */
+ /* if blocked, release call with MT_RELEASE_COMPLETE */
if (p_m_mISDNport->ifport->block)
{
RELEASE_COMPLETE_t *release_complete;
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, dinfo, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE_COMPLETE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 27); /* temporary unavailable */
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 27); /* temporary unavailable */
+#endif
add_trace("reason", NULL, "port blocked");
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
return;
if (ret < 0)
{
no_channel:
+ /*
+ * NOTE: we send MT_RELEASE_COMPLETE to "REJECT" the channel
+ * in response to the setup
+ */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
RELEASE_COMPLETE_t *release_complete;
-
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, dinfo, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE_COMPLETE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
return;
/* CC_CONNECT INDICATION */
void Pdss1::connect_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
CONNECT_t *connect = (CONNECT_t *)((unsigned long)data + headerlen);
+ CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
+#endif
int exclusive, channel;
int type, plan, present, screen;
int ret;
- msg_t *dmsg;
struct message *message;
int bchannel_before;
- CONNECT_ACKNOWLEDGE_t *connect_acknowledge;
if (p_m_d_ntmode)
p_m_d_ces = connect->ces;
if (p_m_d_ntmode)
{
/* send connect acknowledge */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_CONNECT | RESPONSE, MT_CONNECT, dinfo, sizeof(CONNECT_ACKNOWLEDGE_t), p_m_d_ntmode);
connect_acknowledge = (CONNECT_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_CONNECT | RESPONSE, DIRECTION_OUT);
/* if we had no bchannel before, we send it now */
if (!bchannel_before && p_m_b_channel)
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&connect_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_CONNECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
message = message_create(p_serial, ACTIVE_EPOINT(p_epointlist), PORT_TO_EPOINT, MESSAGE_CONNECT);
/* release if remote sends us no tones */
if (!p_m_mISDNport->earlyb)
{
- RELEASE_t *release;
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
msg_t *dmsg;
+ RELEASE_t *release;
+#endif
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, dinfo, sizeof(RELEASE_t), p_m_d_ntmode);
release = (RELEASE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 16); /* normal */
+#else
enc_ie_cause(&release->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 16); /* normal */
+#endif
add_trace("reason", NULL, "no remote patterns");
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
/* sending release to endpoint */
while(p_epointlist)
/* CC_RELEASE INDICATION */
void Pdss1::release_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- RELEASE_t *release = (RELEASE_t *)((unsigned long)data + headerlen);
msg_t *dmsg;
+ RELEASE_t *release = (RELEASE_t *)((unsigned long)data + headerlen);
+#endif
int location, cause;
struct message *message;
/* sending release complete */
RELEASE_COMPLETE_t *release_complete;
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, dinfo, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE_COMPLETE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 16);
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, 16);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
new_state(PORT_STATE_RELEASE);
/* CC_HOLD INDICATION */
void Pdss1::hold_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+ struct message *message;
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
// HOLD_t *hold = (HOLD_t *)((unsigned long)data + headerlen);
- struct message *message;
HOLD_REJECT_t *hold_reject;
HOLD_ACKNOWLEDGE_t *hold_acknowledge;
- msg_t *dmsg;
+#endif
// class Endpoint *epoint;
l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
if (!ACTIVE_EPOINT(p_epointlist) || p_m_hold)
{
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_HOLD_REJECT | REQUEST, MT_HOLD_REJECT, dinfo, sizeof(HOLD_REJECT_t), p_m_d_ntmode);
hold_reject = (HOLD_REJECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_HOLD_REJECT | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, p_m_hold?101:31); /* normal unspecified / incompatible state */
+#else
enc_ie_cause(&hold_reject->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, p_m_hold?101:31); /* normal unspecified / incompatible state */
+#endif
add_trace("reason", NULL, "no endpoint");
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_HOLD_REJECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
return;
}
#endif
/* acknowledge hold */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_HOLD_ACKNOWLEDGE | REQUEST, MT_HOLD_ACKNOWLEDGE, dinfo, sizeof(HOLD_ACKNOWLEDGE_t), p_m_d_ntmode);
hold_acknowledge = (HOLD_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_HOLD_ACKNOWLEDGE | REQUEST, DIRECTION_OUT);
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_HOLD_ACKNOWLEDGE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
/* CC_RETRIEVE INDICATION */
void Pdss1::retrieve_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
RETRIEVE_t *retrieve = (RETRIEVE_t *)((unsigned long)data + headerlen);
RETRIEVE_REJECT_t *retrieve_reject;
RETRIEVE_ACKNOWLEDGE_t *retrieve_acknowledge;
+#endif
struct message *message;
int channel, exclusive, cause;
- msg_t *dmsg;
int ret;
l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
cause = 101; /* incompatible state */
reject:
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RETRIEVE_REJECT | REQUEST, MT_RETRIEVE_REJECT, dinfo, sizeof(RETRIEVE_REJECT_t), p_m_d_ntmode);
retrieve_reject = (RETRIEVE_REJECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RETRIEVE_REJECT | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, cause);
+#else
enc_ie_cause(&retrieve_reject->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, cause);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RETRIEVE_REJECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
return;
}
p_m_timeout = 0;
/* acknowledge retrieve */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RETRIEVE_ACKNOWLEDGE | REQUEST, MT_RETRIEVE_ACKNOWLEDGE, dinfo, sizeof(RETRIEVE_ACKNOWLEDGE_t), p_m_d_ntmode);
retrieve_acknowledge = (RETRIEVE_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RETRIEVE_ACKNOWLEDGE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&retrieve_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RETRIEVE_ACKNOWLEDGE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
/* CC_SUSPEND INDICATION */
void Pdss1::suspend_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
SUSPEND_t *suspend = (SUSPEND_t *)((unsigned long)data + headerlen);
SUSPEND_ACKNOWLEDGE_t *suspend_acknowledge;
SUSPEND_REJECT_t *suspend_reject;
+#endif
struct message *message;
class Endpoint *epoint;
unsigned char callid[8];
int len;
- msg_t *dmsg;
int ret = -31; /* normal, unspecified */
l1l2l3_trace_header(p_m_mISDNport, this, prim, DIRECTION_IN);
if (!ACTIVE_EPOINT(p_epointlist))
{
reject:
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_SUSPEND_REJECT | REQUEST, MT_SUSPEND_REJECT, dinfo, sizeof(SUSPEND_REJECT_t), p_m_d_ntmode);
suspend_reject = (SUSPEND_REJECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_SUSPEND_REJECT | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#else
enc_ie_cause(&suspend_reject->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_SUSPEND_REJECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
return;
}
}
/* sending SUSPEND_ACKNOWLEDGE */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_SUSPEND_ACKNOWLEDGE | REQUEST, MT_SUSPEND_ACKNOWLEDGE, dinfo, sizeof(SUSPEND_ACKNOWLEDGE_t), p_m_d_ntmode);
suspend_acknowledge = (SUSPEND_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_SUSPEND_ACKNOWLEDGE | REQUEST, DIRECTION_OUT);
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_SUSPEND_ACKNOWLEDGE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
/* CC_RESUME INDICATION */
void Pdss1::resume_ind(unsigned long prim, unsigned long dinfo, void *data)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
RESUME_t *resume = (RESUME_t *)((unsigned long)data + headerlen);
RESUME_REJECT_t *resume_reject;
RESUME_ACKNOWLEDGE_t *resume_acknowledge;
+#endif
unsigned char callid[8];
int len;
int channel, exclusive;
- msg_t *dmsg;
class Endpoint *epoint;
struct message *message;
int ret;
{
no_channel:
reject:
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RESUME_REJECT | REQUEST, MT_RESUME_REJECT, dinfo, sizeof(RESUME_REJECT_t), p_m_d_ntmode);
resume_reject = (RESUME_REJECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RESUME_REJECT | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#else
enc_ie_cause(&resume_reject->CAUSE, dmsg, (p_m_mISDNport->locally)?LOCATION_PRIVATE_LOCAL:LOCATION_PRIVATE_REMOTE, -ret);
+#endif
if (ret == -27)
add_trace("reason", NULL, "port blocked");
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RESUME_REJECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
return;
message_put(message);
/* sending RESUME_ACKNOWLEDGE */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RESUME_ACKNOWLEDGE | REQUEST, MT_RESUME_ACKNOWLEDGE, dinfo, sizeof(RESUME_ACKNOWLEDGE_t), p_m_d_ntmode);
resume_acknowledge = (RESUME_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RESUME_ACKNOWLEDGE | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&resume_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RESUME_ACKNOWDGE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_CONNECT);
}
/* MESSAGE_INFORMATION */
void Pdss1::message_information(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- INFORMATION_t *information;
msg_t *dmsg;
+ INFORMATION_t *information;
+#endif
if (param->information.id[0]) /* only if we have something to dial */
{
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
information = (INFORMATION_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_called_pn(l3m, 0, 1, (unsigned char *)param->information.id);
+#else
enc_ie_called_pn(&information->CALLED_PN, dmsg, 0, 1, (unsigned char *)param->information.id);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_INFORMATION, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
new_state(p_state);
}
/* MESSAGE_SETUP */
void Pdss1::message_setup(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
INFORMATION_t *information;
SETUP_t *setup;
- msg_t *dmsg;
+#endif
int plan, type, screen, present, reason;
int capability, mode, rate, coding, user, presentation, interpretation, hlc, exthlc;
int channel, exclusive;
if (p_callerinfo.display[0])
{
/* sending information */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
information = (INFORMATION_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
if (p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p_callerinfo.display);
+#else
enc_ie_display(&information->DISPLAY, dmsg, (unsigned char *)p_callerinfo.display);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_INFORMATION, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
return;
}
}
end_trace();
/* preparing setup message */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_SETUP | REQUEST, MT_SETUP, p_m_d_l3id, sizeof(SETUP_t), p_m_d_ntmode);
setup = (SETUP_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_SETUP | REQUEST, DIRECTION_OUT);
/* channel information */
if (channel >= 0) /* it should */
{
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, exclusive, channel);
+#else
enc_ie_channel_id(&setup->CHANNEL_ID, dmsg, exclusive, channel);
+#endif
}
/* caller information */
plan = 1;
break;
}
if (type >= 0)
+#ifdef SOCKET_MISDN
+ enc_ie_calling_pn(l3m, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
+#else
enc_ie_calling_pn(&setup->CALLING_PN, dmsg, type, plan, present, screen, (unsigned char *)p_callerinfo.id);
+#endif
/* dialing information */
if (p_dialinginfo.id[0]) /* only if we have something to dial */
{
+#ifdef SOCKET_MISDN
+ enc_ie_called_pn(l3m, 0, 1, (unsigned char *)p_dialinginfo.id);
+#else
enc_ie_called_pn(&setup->CALLED_PN, dmsg, 0, 1, (unsigned char *)p_dialinginfo.id);
+#endif
}
/* sending complete */
if (p_dialinginfo.sending_complete)
+#ifdef SOCKET_MISDN
+ enc_ie_complete(l3m, 1);
+#else
enc_ie_complete(&setup->COMPLETE, dmsg, 1);
+#endif
/* sending user-user */
if (param->setup.useruser.len)
{
+#ifdef SOCKET_MISDN
+ enc_ie_useruser(l3m, param->setup.useruser.protocol, param->setup.useruser.data, param->setup.useruser.len);
+#else
enc_ie_useruser(&setup->USER_USER, dmsg, param->setup.useruser.protocol, param->setup.useruser.data, param->setup.useruser.len);
+#endif
}
/* redirecting number */
plan = 1;
}
/* sending redirecting number only in ntmode */
if (type >= 0 && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_redir_nr(l3m, type, plan, present, screen, reason, (unsigned char *)p_redirinfo.id);
+#else
enc_ie_redir_nr(&setup->REDIR_NR, dmsg, type, plan, present, screen, reason, (unsigned char *)p_redirinfo.id);
+#endif
/* bearer capability */
//printf("hlc=%d\n",p_capainfo.hlc);
coding = 0;
user = p_capainfo.bearer_info1 & 0x7f;
break;
}
+#ifdef SOCKET_MISDN
+ enc_ie_bearer(l3m, coding, capability, mode, rate, -1, user);
+#else
enc_ie_bearer(&setup->BEARER, dmsg, coding, capability, mode, rate, -1, user);
+#endif
/* hlc */
if (p_capainfo.hlc)
{
exthlc = -1;
if (p_capainfo.exthlc)
exthlc = p_capainfo.exthlc & 0x7f;
+#ifdef SOCKET_MISDN
+ enc_ie_hlc(l3m, coding, interpretation, presentation, hlc, exthlc);
+#else
enc_ie_hlc(&setup->HLC, dmsg, coding, interpretation, presentation, hlc, exthlc);
+#endif
}
/* display */
if (p_callerinfo.display[0] && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p_callerinfo.display);
+#else
enc_ie_display(&setup->DISPLAY, dmsg, (unsigned char *)p_callerinfo.display);
+#endif
/* nt-mode: CNIP (calling name identification presentation) */
// if (p_callerinfo.name[0] && p_m_d_ntmode)
// enc_facility_centrex(&setup->FACILITY, dmsg, (unsigned char *)p_callerinfo.name, 1);
end_trace();
/* send setup message now */
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_SETUP, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_OUT_SETUP);
}
/* MESSAGE_FACILITY */
void Pdss1::message_facility(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- FACILITY_t *facility;
msg_t *dmsg;
+ FACILITY_t *facility;
+#endif
/* facility will not be sent to external lines */
if (!p_m_d_ntmode)
return;
/* sending facility */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_FACILITY | REQUEST, MT_FACILITY, p_m_d_l3id, sizeof(FACILITY_t), p_m_d_ntmode);
facility = (FACILITY_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_FACILITY | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_facility(l3m, (unsigned char *)param->facilityinfo.data, param->facilityinfo.len);
+#else
enc_ie_facility(&facility->FACILITY, dmsg, (unsigned char *)param->facilityinfo.data, param->facilityinfo.len);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_FACILITY, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
/* MESSAGE_NOTIFY */
void Pdss1::message_notify(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
INFORMATION_t *information;
NOTIFY_t *notification;
+#endif
int notify;
int plan, type = -1, present;
- msg_t *dmsg;
if (param->notifyinfo.notify>INFO_NOTIFY_NONE)
notify = param->notifyinfo.notify & 0x7f;
} else
{
/* sending notification */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_NOTIFY | REQUEST, MT_NOTIFY, p_m_d_l3id, sizeof(NOTIFY_t), p_m_d_ntmode);
notification = (NOTIFY_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_NOTIFY | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_notify(l3m, notify);
+#else
enc_ie_notify(¬ification->NOTIFY, dmsg, notify);
+#endif
/* sending redirection number only in ntmode */
if (type >= 0 && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_redir_dn(l3m, type, plan, present, (unsigned char *)param->notifyinfo.id);
+#else
enc_ie_redir_dn(¬ification->REDIR_DN, dmsg, type, plan, present, (unsigned char *)param->notifyinfo.id);
+#endif
if (param->notifyinfo.display[0] && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)param->notifyinfo.display);
+#else
enc_ie_display(¬ification->DISPLAY, dmsg, (unsigned char *)param->notifyinfo.display);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_NOTIFICATION, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
} else if (p_m_d_ntmode)
{
/* sending information */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
information = (INFORMATION_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)param->notifyinfo.display);
+#else
enc_ie_display(&information->DISPLAY, dmsg, (unsigned char *)param->notifyinfo.display);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_INFORMATION, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
}
/* MESSAGE_OVERLAP */
void Pdss1::message_overlap(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- SETUP_ACKNOWLEDGE_t *setup_acknowledge;
msg_t *dmsg;
+ SETUP_ACKNOWLEDGE_t *setup_acknowledge;
+#endif
/* sending setup_acknowledge */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_SETUP_ACKNOWLEDGE | REQUEST, MT_SETUP_ACKNOWLEDGE, p_m_d_l3id, sizeof(SETUP_ACKNOWLEDGE_t), p_m_d_ntmode);
setup_acknowledge = (SETUP_ACKNOWLEDGE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_SETUP_ACKNOWLEDGE | REQUEST, DIRECTION_OUT);
/* channel information */
if (p_state == PORT_STATE_IN_SETUP)
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&setup_acknowledge->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
if (p_m_mISDNport->tones)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&setup_acknowledge->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_SETUP_ACKNOWLEDGE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_OVERLAP);
}
/* MESSAGE_PROCEEDING */
void Pdss1::message_proceeding(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- CALL_PROCEEDING_t *proceeding;
msg_t *dmsg;
+ CALL_PROCEEDING_t *proceeding;
+#endif
/* sending proceeding */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, p_m_d_l3id, sizeof(CALL_PROCEEDING_t), p_m_d_ntmode);
proceeding = (CALL_PROCEEDING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_PROCEEDING | REQUEST, DIRECTION_OUT);
/* channel information */
if (p_state == PORT_STATE_IN_SETUP)
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&proceeding->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
if (p_m_mISDNport->tones)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_PROCEEDING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_PROCEEDING);
}
/* MESSAGE_ALERTING */
void Pdss1::message_alerting(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
- ALERTING_t *alerting;
msg_t *dmsg;
+ ALERTING_t *alerting;
+#endif
/* NT-MODE in setup state we must send PROCEEDING first */
if (p_m_d_ntmode && p_state==PORT_STATE_IN_SETUP)
CALL_PROCEEDING_t *proceeding;
/* sending proceeding */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, p_m_d_l3id, sizeof(CALL_PROCEEDING_t), p_m_d_ntmode);
proceeding = (CALL_PROCEEDING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_PROCEEDING | REQUEST, DIRECTION_OUT);
/* channel information */
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&proceeding->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_PROCEEDING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_PROCEEDING);
}
/* sending alerting */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_ALERTING | REQUEST, MT_ALERTING, p_m_d_l3id, sizeof(ALERTING_t), p_m_d_ntmode);
alerting = (ALERTING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_ALERTING | REQUEST, DIRECTION_OUT);
/* channel information */
if (p_state == PORT_STATE_IN_SETUP)
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&alerting->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
if (p_m_mISDNport->tones)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&alerting->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_ALERTING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_ALERTING);
}
/* MESSAGE_CONNECT */
void Pdss1::message_connect(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
INFORMATION_t *information;
CONNECT_t *connect;
+#endif
int type, plan, present, screen;
- msg_t *dmsg;
class Endpoint *epoint;
/* NT-MODE in setup state we must send PROCEEDING first */
CALL_PROCEEDING_t *proceeding;
/* sending proceeding */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, p_m_d_l3id, sizeof(CALL_PROCEEDING_t), p_m_d_ntmode);
proceeding = (CALL_PROCEEDING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_PROCEEDING | REQUEST, DIRECTION_OUT);
/* channel information */
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&proceeding->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
// /* progress information */
// if (p_capainfo.bearer_capa==INFO_BC_SPEECH
// || p_capainfo.bearer_capa==INFO_BC_AUDIO
// || p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+#ifdef SOCKET_MISDN
+// enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
// enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_PROCEEDING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_PROCEEDING);
}
if (p_connectinfo.display[0])
{
/* sending information */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_INFORMATION | REQUEST, MT_INFORMATION, p_m_d_l3id, sizeof(INFORMATION_t), p_m_d_ntmode);
information = (INFORMATION_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_INFORMATION | REQUEST, DIRECTION_OUT);
if (p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p_connectinfo.display);
+#else
enc_ie_display(&information->DISPLAY, dmsg, (unsigned char *)p_connectinfo.display);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_INFORMATION, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
return;
}
}
/* preparing connect message */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_CONNECT | REQUEST, MT_CONNECT, p_m_d_l3id, sizeof(CONNECT_t), p_m_d_ntmode);
connect = (CONNECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_CONNECT | REQUEST, DIRECTION_OUT);
/* connect information */
plan = 1;
break;
}
if (type >= 0)
+#ifdef SOCKET_MISDN
+ enc_ie_connected_pn(l3m, type, plan, present, screen, (unsigned char *)p_connectinfo.id);
+#else
enc_ie_connected_pn(&connect->CONNECT_PN, dmsg, type, plan, present, screen, (unsigned char *)p_connectinfo.id);
+#endif
/* display */
if (p_connectinfo.display[0] && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p_connectinfo.display);
+#else
enc_ie_display(&connect->DISPLAY, dmsg, (unsigned char *)p_connectinfo.display);
+#endif
/* nt-mode: CONP (connected name identification presentation) */
// if (p_connectinfo.name[0] && p_m_d_ntmode)
// enc_facility_centrex(&connect->FACILITY, dmsg, (unsigned char *)p_connectinfo.name, 0);
if (p_m_d_ntmode)
{
epoint = find_epoint_id(epoint_id);
+#ifdef SOCKET_MISDN
+ enc_ie_date(l3m, now, p_settings.no_seconds);
+#else
enc_ie_date(&connect->DATE, dmsg, now, p_settings.no_seconds);
+#endif
}
end_trace();
/* finally send message */
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_CONNECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
if (p_m_d_ntmode)
new_state(PORT_STATE_CONNECT);
/* MESSAGE_DISCONNECT */
void Pdss1::message_disconnect(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
DISCONNECT_t *disconnect;
RELEASE_COMPLETE_t *release_complete;
- msg_t *dmsg;
+#endif
struct message *message;
char *p = NULL;
free_epointlist(p_epointlist);
}
/* sending release */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, p_m_d_l3id, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE_COMPLETE | REQUEST, DIRECTION_OUT);
/* send cause */
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
p_m_delete = 1;
return;
CALL_PROCEEDING_t *proceeding;
/* sending proceeding */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, p_m_d_l3id, sizeof(CALL_PROCEEDING_t), p_m_d_ntmode);
proceeding = (CALL_PROCEEDING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_PROCEEDING | REQUEST, DIRECTION_OUT);
/* channel information */
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&proceeding->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_PROCEEDING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_IN_PROCEEDING);
}
/* sending disconnect */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT, p_m_d_l3id, sizeof(DISCONNECT_t), p_m_d_ntmode);
disconnect = (DISCONNECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_DISCONNECT | REQUEST, DIRECTION_OUT);
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
if (p_m_mISDNport->tones)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
/* send cause */
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#else
enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#endif
/* send display */
if (param->disconnectinfo.display[0])
p = param->disconnectinfo.display;
if (p) if (*p && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p);
+#else
enc_ie_display(&disconnect->DISPLAY, dmsg, (unsigned char *)p);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_DISCONNECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_OUT_DISCONNECT);
}
/* MESSAGE_RELEASE */
void Pdss1::message_release(unsigned long epoint_id, int message_id, union parameter *param)
{
+#ifdef SOCKET_MISDN
+ l3_msg *l3m;
+#else
int headerlen = (p_m_d_ntmode)?mISDNUSER_HEAD_SIZE:mISDN_HEADER_LEN;
+ msg_t *dmsg;
RELEASE_t *release;
RELEASE_COMPLETE_t *release_complete;
DISCONNECT_t *disconnect;
- msg_t *dmsg;
+#endif
class Endpoint *epoint;
char *p = NULL;
|| p_state == PORT_STATE_OUT_DISCONNECT)
{
/* sending release */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE | REQUEST, MT_RELEASE, p_m_d_l3id, sizeof(RELEASE_t), p_m_d_ntmode);
release = (RELEASE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE | REQUEST, DIRECTION_OUT);
/* send cause */
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#else
enc_ie_cause(&release->CAUSE, dmsg, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
/* remove epoint */
free_epointid(epoint_id);
//#warning remove me
//PDEBUG(DEBUG_LOG, "JOLLY sending release complete %d\n", p_serial);
/* sending release complete */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_RELEASE_COMPLETE | REQUEST, MT_RELEASE_COMPLETE, p_m_d_l3id, sizeof(RELEASE_COMPLETE_t), p_m_d_ntmode);
release_complete = (RELEASE_COMPLETE_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_RELEASE | REQUEST, DIRECTION_OUT);
/* send cause */
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#else
enc_ie_cause(&release_complete->CAUSE, dmsg, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_RELEASE_COMPLETE, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_RELEASE);
/* remove epoint */
free_epointid(epoint_id);
CALL_PROCEEDING_t *proceeding;
/* sending proceeding */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_PROCEEDING | REQUEST, MT_CALL_PROCEEDING, p_m_d_l3id, sizeof(CALL_PROCEEDING_t), p_m_d_ntmode);
proceeding = (CALL_PROCEEDING_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_PROCEEDING | REQUEST, DIRECTION_OUT);
/* channel information */
+#ifdef SOCKET_MISDN
+ enc_ie_channel_id(l3m, 1, p_m_b_channel);
+#else
enc_ie_channel_id(&proceeding->CHANNEL_ID, dmsg, 1, p_m_b_channel);
+#endif
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&proceeding->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_PROCEEDING, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
}
#endif
/* sending disconnect */
+#ifdef SOCKET_MISDN
+ l3m = create_l3msg();
+#else
dmsg = create_l3msg(CC_DISCONNECT | REQUEST, MT_DISCONNECT, p_m_d_l3id, sizeof(DISCONNECT_t), p_m_d_ntmode);
disconnect = (DISCONNECT_t *)(dmsg->data + headerlen);
+#endif
l1l2l3_trace_header(p_m_mISDNport, this, CC_DISCONNECT | REQUEST, DIRECTION_OUT);
/* progress information */
if (p_capainfo.bearer_capa==INFO_BC_SPEECH
|| p_capainfo.bearer_capa==INFO_BC_AUDIO
|| p_capainfo.bearer_capa==INFO_BC_DATAUNRESTRICTED_TONES)
if (p_m_mISDNport->tones)
+#ifdef SOCKET_MISDN
+ enc_ie_progress(l3m, 0, p_m_d_ntmode?1:5, 8);
+#else
enc_ie_progress(&disconnect->PROGRESS, dmsg, 0, p_m_d_ntmode?1:5, 8);
+#endif
/* send cause */
+#ifdef SOCKET_MISDN
+ enc_ie_cause(l3m, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#else
enc_ie_cause(&disconnect->CAUSE, dmsg, (p_m_mISDNport->locally && param->disconnectinfo.location==LOCATION_PRIVATE_LOCAL)?LOCATION_PRIVATE_LOCAL:param->disconnectinfo.location, param->disconnectinfo.cause);
+#endif
/* send display */
epoint = find_epoint_id(epoint_id);
if (param->disconnectinfo.display[0])
p = param->disconnectinfo.display;
if (p) if (*p && p_m_d_ntmode)
+#ifdef SOCKET_MISDN
+ enc_ie_display(l3m, (unsigned char *)p);
+#else
enc_ie_display(&disconnect->DISPLAY, dmsg, (unsigned char *)p);
+#endif
end_trace();
+#ifdef SOCKET_MISDN
+ p_m_mISDNport->layer3->to_layer3(p_m_mISDNport->layer3, MT_DISCONNECT, l3m);
+#else
msg_queue_tail(&p_m_mISDNport->downqueue, dmsg);
+#endif
new_state(PORT_STATE_OUT_DISCONNECT);
/* remove epoint */
free_epointid(epoint_id);
/* IE_COMPLETE */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_complete(struct l3_msg *l3m, int complete)
+#else
void Pdss1::enc_ie_complete(unsigned char **ntmode, msg_t *msg, int complete)
+#endif
{
+#ifndef SOCKET_MISDN
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
if (complete<0 || complete>1)
{
if (complete)
{
add_trace("complete", NULL, NULL);
+#ifndef SOCKET_MISDN
p = msg_put(msg, 1);
if (p_m_d_ntmode)
{
} else
qi->sending_complete.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
p[0] = IE_COMPLETE;
+#else
+ l3m->sending_complete++;
+#endif
}
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_complete(struct l3_msg *l3m, int *complete)
+#else
void Pdss1::dec_ie_complete(unsigned char *p, Q931_info_t *qi, int *complete)
+#endif
{
*complete = 0;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
if (qi->sending_complete.off)
*complete = 1;
} else
+#else
+ unsigned char *p = l3m->sending_complete;
+#endif
if (p)
*complete = 1;
/* IE_BEARER */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_bearer(struct l3_msg *l3m, int coding, int capability, int mode, int rate, int multi, int user)
+#else
void Pdss1::enc_ie_bearer(unsigned char **ntmode, msg_t *msg, int coding, int capability, int mode, int rate, int multi, int user)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (coding<0 || coding>3)
add_trace("bearer", "user", "%d", user);
l = 2 + (multi>=0) + (user>=0);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->bearer_capability.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_BEARER;
p[1] = l;
p[2] = 0x80 + (coding<<5) + capability;
p[4] = 0x80 + multi;
if (user >= 0)
p[4+(multi>=0)] = 0xa0 + user;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_bearer(struct l3_msg *l3m, int *coding, int *capability, int *mode, int *rate, int *multi, int *user)
+#else
void Pdss1::dec_ie_bearer(unsigned char *p, Q931_info_t *qi, int *coding, int *capability, int *mode, int *rate, int *multi, int *user)
+#endif
{
*coding = -1;
*capability = -1;
*multi = -1;
*user = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->bearer_capability.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->bearer_capability.off + 1;
}
+#else
+ unsigned char *p = l3m->bearer_capability;
+#endif
if (!p)
return;
if (p[0] < 2)
/* IE_HLC */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_hlc(struct l3_msg *l3m, int coding, int interpretation, int presentation, int hlc, int exthlc)
+#else
void Pdss1::enc_ie_hlc(unsigned char **ntmode, msg_t *msg, int coding, int interpretation, int presentation, int hlc, int exthlc)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (coding<0 || coding>3)
add_trace("hlc", "exthlc", "%d", exthlc);
l = 2 + (exthlc>=0);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->hlc.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_HLC;
p[1] = l;
p[2] = 0x80 + (coding<<5) + (interpretation<<2) + presentation;
p[4] = 0x80 + exthlc;
} else
p[3] = 0x80 + hlc;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_hlc(struct l3_msg *l3m, int *coding, int *interpretation, int *presentation, int *hlc, int *exthlc)
+#else
void Pdss1::dec_ie_hlc(unsigned char *p, Q931_info_t *qi, int *coding, int *interpretation, int *presentation, int *hlc, int *exthlc)
+#endif
{
*coding = -1;
*interpretation = -1;
*hlc = -1;
*exthlc = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->hlc.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->hlc.off + 1;
}
+#else
+ unsigned char *p = l3m->hlc;
+#endif
if (!p)
return;
if (p[0] < 2)
/* IE_CALL_ID */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_call_id(struct l3_msg *l3m, unsigned char *callid, int callid_len)
+#else
void Pdss1::enc_ie_call_id(unsigned char **ntmode, msg_t *msg, unsigned char *callid, int callid_len)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
char buffer[25];
add_trace("callid", NULL, "%s", buffer[0]?buffer+1:"<none>");
l = callid_len;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->call_id.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CALL_ID;
p[1] = l;
memcpy(p+2, callid, callid_len);
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_call_id(struct l3_msg *l3m, unsigned char *callid, int *callid_len)
+#else
void Pdss1::dec_ie_call_id(unsigned char *p, Q931_info_t *qi, unsigned char *callid, int *callid_len)
+#endif
{
char buffer[25];
int i;
*callid_len = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->call_id.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->call_id.off + 1;
}
+#else
+ unsigned char *p = l3m->call_id;
+#endif
if (!p)
return;
if (p[0] > 8)
/* IE_CALLED_PN */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_called_pn(struct l3_msg *l3m, int type, int plan, unsigned char *number)
+#else
void Pdss1::enc_ie_called_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, unsigned char *number)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (type<0 || type>7)
add_trace("called_pn", "number", "%s", number);
l = 1+strlen((char *)number);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->called_nr.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CALLED_PN;
p[1] = l;
p[2] = 0x80 + (type<<4) + plan;
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_called_pn(struct l3_msg *l3m, int *type, int *plan, unsigned char *number, int number_len)
+#else
void Pdss1::dec_ie_called_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, unsigned char *number, int number_len)
+#endif
{
*type = -1;
*plan = -1;
*number = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->called_nr.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->called_nr.off + 1;
}
+#else
+ unsigned char *p = l3m->called_nr;
+#endif
if (!p)
return;
if (p[0] < 2)
/* IE_CALLING_PN */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_calling_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number)
+#else
void Pdss1::enc_ie_calling_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, unsigned char *number)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (type<0 || type>7)
l += strlen((char *)number);
if (present >= 0)
l += 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->calling_nr.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CALLING_PN;
p[1] = l;
if (present >= 0)
if (number) if (number[0])
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
}
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_calling_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len)
+#else
void Pdss1::dec_ie_calling_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len)
+#endif
{
*type = -1;
*plan = -1;
*screen = -1;
*number = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->calling_nr.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->calling_nr.off + 1;
}
+#else
+ unsigned char *p = l3m->calling_nr;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_CONNECTED_PN */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_connected_pn(struct l3_msg *l3m, int type, int plan, int present, int screen, unsigned char *number)
+#else
void Pdss1::enc_ie_connected_pn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, unsigned char *number)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (type<0 || type>7)
l += strlen((char *)number);
if (present >= 0)
l += 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->connected_nr.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CONNECT_PN;
p[1] = l;
if (present >= 0)
if (number) if (number[0])
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
}
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_connected_pn(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len)
+#else
void Pdss1::dec_ie_connected_pn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, unsigned char *number, int number_len)
+#endif
{
*type = -1;
*plan = -1;
*screen = -1;
*number = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->connected_nr.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->connected_nr.off + 1;
}
+#else
+ unsigned char *p = l3m->connected_nr;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_CAUSE */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_cause(struct l3_msg *l3m, int location, int cause)
+#else
void Pdss1::enc_ie_cause(unsigned char **ntmode, msg_t *msg, int location, int cause)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (location<0 || location>7)
add_trace("cause", "value", "%d", cause);
l = 2;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->cause.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CAUSE;
p[1] = l;
p[2] = 0x80 + location;
p[3] = 0x80 + cause;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void enc_ie_cause_standalone(struct l3_msg *l3m, int location, int cause)
+#else
void enc_ie_cause_standalone(unsigned char **ntmode, msg_t *msg, int location, int cause)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p = msg_put(msg, 4);
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
if (ntmode)
*ntmode = p+1;
else
qi->cause.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CAUSE;
p[1] = 2;
p[2] = 0x80 + location;
p[3] = 0x80 + cause;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_cause(struct l3_msg *l3m, int *location, int *cause)
+#else
void Pdss1::dec_ie_cause(unsigned char *p, Q931_info_t *qi, int *location, int *cause)
+#endif
{
*location = -1;
*cause = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->cause.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->cause.off + 1;
}
+#else
+ unsigned char *p = l3m->cause;
+#endif
if (!p)
return;
if (p[0] < 2)
/* IE_CHANNEL_ID */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_channel_id(struct l3_msg *l3m, int exclusive, int channel)
+#else
void Pdss1::enc_ie_channel_id(unsigned char **ntmode, msg_t *msg, int exclusive, int channel)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
int pri = p_m_mISDNport->pri;
{
/* BRI */
l = 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->channel_id.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CHANNEL_ID;
p[1] = l;
if (channel == CHANNEL_NO)
else if (channel == CHANNEL_ANY)
channel = 3;
p[2] = 0x80 + (exclusive<<3) + channel;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
} else
{
/* PRI */
if (channel == CHANNEL_ANY) /* any channel */
{
l = 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->channel_id.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CHANNEL_ID;
p[1] = l;
p[2] = 0x80 + 0x20 + 0x03;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
return; /* end */
}
l = 3;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->channel_id.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_CHANNEL_ID;
p[1] = l;
p[2] = 0x80 + 0x20 + (exclusive<<3) + 0x01;
p[3] = 0x80 + 3; /* CCITT, Number, B-type */
p[4] = 0x80 + channel;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_channel_id(struct l3_msg *l3m, int *exclusive, int *channel)
+#else
void Pdss1::dec_ie_channel_id(unsigned char *p, Q931_info_t *qi, int *exclusive, int *channel)
+#endif
{
int pri = p_m_mISDNport->pri;
*exclusive = -1;
*channel = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->channel_id.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->channel_id.off + 1;
}
+#else
+ unsigned char *p = l3m->channel_id;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_DATE */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_date(struct l3_msg *l3m, time_t ti, int no_seconds)
+#else
void Pdss1::enc_ie_date(unsigned char **ntmode, msg_t *msg, time_t ti, int no_seconds)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
struct tm *tm;
add_trace("date", "time", "%d:%d:%d", tm->tm_hour, tm->tm_min, tm->tm_sec);
l = 5 + (!no_seconds);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->date.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_DATE;
p[1] = l;
p[2] = tm->tm_year % 100;
p[6] = tm->tm_min;
if (!no_seconds)
p[7] = tm->tm_sec;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
/* IE_DISPLAY */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_display(struct l3_msg *l3m, unsigned char *display)
+#else
void Pdss1::enc_ie_display(unsigned char **ntmode, msg_t *msg, unsigned char *display)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (!display[0])
add_trace("display", NULL, "%s", display);
l = strlen((char *)display);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->display.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_DISPLAY;
p[1] = l;
UNCPY((char *)p+2, (char *)display, strlen((char *)display));
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_display(struct l3_msg *l3m, unsigned char *display, int display_len)
+#else
void Pdss1::dec_ie_display(unsigned char *p, Q931_info_t *qi, unsigned char *display, int display_len)
+#endif
{
*display = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->display.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->display.off + 1;
}
+#else
+ unsigned char *p = l3m->display;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_KEYPAD */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_keypad(struct l3_msg *l3m, unsigned char *keypad)
+#else
void Pdss1::enc_ie_keypad(unsigned char **ntmode, msg_t *msg, unsigned char *keypad)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (!keypad[0])
add_trace("keypad", NULL, "%s", keypad);
l = strlen((char *)keypad);
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->keypad.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_KEYPAD;
p[1] = l;
UNCPY((char *)p+2, (char *)keypad, strlen((char *)keypad));
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_keypad(struct l3_msg *l3m, unsigned char *keypad, int keypad_len)
+#else
void Pdss1::dec_ie_keypad(unsigned char *p, Q931_info_t *qi, unsigned char *keypad, int keypad_len)
+#endif
{
*keypad = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->keypad.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->keypad.off + 1;
}
+#else
+ unsigned char *p = l3m->keypad;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_NOTIFY */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_notify(struct l3_msg *l3m, int notify)
+#else
void Pdss1::enc_ie_notify(unsigned char **ntmode, msg_t *msg, int notify)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (notify<0 || notify>0x7f)
add_trace("notify", NULL, "%d", notify);
l = 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->notify.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_NOTIFY;
p[1] = l;
p[2] = 0x80 + notify;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_notify(struct l3_msg *l3m, int *notify)
+#else
void Pdss1::dec_ie_notify(unsigned char *p, Q931_info_t *qi, int *notify)
+#endif
{
*notify = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->notify.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->notify.off + 1;
}
+#else
+ unsigned char *p = l3m->notify;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_PROGRESS */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_progress(struct l3_msg *l3m, int coding, int location, int progress)
+#else
void Pdss1::enc_ie_progress(unsigned char **ntmode, msg_t *msg, int coding, int location, int progress)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (coding<0 || coding>0x03)
add_trace("progress", "indicator", "%d", progress);
l = 2;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->progress.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_PROGRESS;
p[1] = l;
p[2] = 0x80 + (coding<<5) + location;
p[3] = 0x80 + progress;
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_progress(struct l3_msg *l3m, int *coding, int *location, int *progress)
+#else
void Pdss1::dec_ie_progress(unsigned char *p, Q931_info_t *qi, int *coding, int *location, int *progress)
+#endif
{
*coding = -1;
*location = -1;
*progress = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->progress.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->progress.off + 1;
}
+#else
+ unsigned char *p = l3m->progress;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_REDIR_NR (redirecting = during MT_SETUP) */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_redir_nr(struct l3_msg *l3m, int type, int plan, int present, int screen, int reason, unsigned char *number)
+#else
void Pdss1::enc_ie_redir_nr(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, int screen, int reason, unsigned char *number)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (type<0 || type>7)
if (reason >= 0)
l += 1;
}
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->redirect_nr.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_REDIR_NR;
p[1] = l;
if (present >= 0)
if (number) if (number[0])
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
}
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_redir_nr(struct l3_msg *l3m, int *type, int *plan, int *present, int *screen, int *reason, unsigned char *number, int number_len)
+#else
void Pdss1::dec_ie_redir_nr(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, int *screen, int *reason, unsigned char *number, int number_len)
+#endif
{
*type = -1;
*plan = -1;
*reason = -1;
*number = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->redirect_nr.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->redirect_nr.off + 1;
}
+#else
+ unsigned char *p = l3m->redirect_nr;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_REDIR_DN (redirection = during MT_NOTIFY) */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_redir_dn(struct l3_msg *l3m, int type, int plan, int present, unsigned char *number)
+#else
void Pdss1::enc_ie_redir_dn(unsigned char **ntmode, msg_t *msg, int type, int plan, int present, unsigned char *number)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
if (type<0 || type>7)
l += strlen((char *)number);
if (present >= 0)
l += 1;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->redirect_dn.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_REDIR_DN;
p[1] = l;
if (present >= 0)
if (number)
UNCPY((char *)p+3, (char *)number, strlen((char *)number));
}
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_redir_dn(struct l3_msg *l3m, int *type, int *plan, int *present, unsigned char *number, int number_len)
+#else
void Pdss1::dec_ie_redir_dn(unsigned char *p, Q931_info_t *qi, int *type, int *plan, int *present, unsigned char *number, int number_len)
+#endif
{
*type = -1;
*plan = -1;
*present = -1;
*number = '\0';
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->redirect_dn.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->redirect_dn.off + 1;
}
+#else
+ unsigned char *p = l3m->redirect_dn;
+#endif
if (!p)
return;
if (p[0] < 1)
/* IE_FACILITY */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_facility(struct l3_msg *l3m, unsigned char *facility, int facility_len)
+#else
void Pdss1::enc_ie_facility(unsigned char **ntmode, msg_t *msg, unsigned char *facility, int facility_len)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
char buffer[768];
add_trace("facility", NULL, "%s", buffer+1);
l = facility_len;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+2);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->facility.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_FACILITY;
p[1] = l;
memcpy(p+2, facility, facility_len);
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_facility(struct l3_msg *l3m, unsigned char *facility, int *facility_len)
+#else
void Pdss1::dec_ie_facility(unsigned char *p, Q931_info_t *qi, unsigned char *facility, int *facility_len)
+#endif
{
char debug[768];
int i;
*facility_len = 0;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->facility.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->facility.off + 1;
}
+#else
+ unsigned char *p = l3m->facility;
+#endif
if (!p)
return;
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_facility_centrex(struct l3_msg *l3m, unsigned char *cnip, int cnip_len)
+#else
void Pdss1::dec_facility_centrex(unsigned char *p, Q931_info_t *qi, unsigned char *cnip, int cnip_len)
+#endif
{
unsigned char centrex[256];
char debug[768];
int i = 0, j;
*cnip = '\0';
+#ifdef SOCKET_MISDN
+ dec_ie_facility(l3m, centrex, &facility_len);
+#else
dec_ie_facility(p, qi, centrex, &facility_len);
+#endif
if (facility_len >= 2)
{
if (centrex[i++] != CENTREX_FAC)
/* IE_USERUSER */
+#ifdef SOCKET_MISDN
+void Pdss1::enc_ie_useruser(struct l3_msg *l3m, int protocol, unsigned char *user, int user_len)
+#else
void Pdss1::enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, unsigned char *user, int user_len)
+#endif
{
+#ifdef SOCKET_MISDN
+ unsigned char p[256];
+#else
unsigned char *p;
Q931_info_t *qi = (Q931_info_t *)(msg->data + mISDN_HEADER_LEN);
+#endif
int l;
char buffer[768];
add_trace("useruser", "value", "%s", buffer);
l = user_len;
+#ifndef SOCKET_MISDN
p = msg_put(msg, l+3);
if (p_m_d_ntmode)
*ntmode = p+1;
else
qi->useruser.off = p - (unsigned char *)qi - sizeof(Q931_info_t);
+#endif
p[0] = IE_USER_USER;
p[1] = l;
p[2] = 0x80 + protocol;
memcpy(p+3, user, user_len);
+#ifdef SOCKET_MISDN
+ add_layer3_ie(l3m, p[0], p[1], p+2);
+#endif
}
+#ifdef SOCKET_MISDN
+void Pdss1::dec_ie_useruser(struct l3_msg *l3m, int *protocol, unsigned char *user, int *user_len)
+#else
void Pdss1::dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, unsigned char *user, int *user_len)
+#endif
{
char buffer[768];
int i;
*user_len = 0;
*protocol = -1;
+#ifndef SOCKET_MISDN
if (!p_m_d_ntmode)
{
p = NULL;
if (qi->useruser.off)
p = (unsigned char *)qi + sizeof(Q931_info_t) + qi->useruser.off + 1;
}
+#else
+ unsigned char *p = l3m->useruser;
+#endif
if (!p)
return;