char msgtext[64];
struct interface *interface = interface_first;
- while (interface) {
- if (!strcmp(interface->name, interface_name))
- break;
- interface = interface->next;
- }
+ interface = getinterfacebyname(interface_name);
if (!interface)
return;
};
struct lcr_gsm {
- struct interface *interface; /* interface this instance is associated to */
+ char interface_name[64]; /* name of interface this instance is associated to */
struct lcr_gsm *gsm_ms_next; /* list of MS instances, in case of MS */
char name[16]; /* name of MS instance, in case of MS */
int type; /* LCR_GSM_TYPE_*/
class Endpoint *epoint;
struct lcr_msg *message;
struct gsm_mncc *mode, *proceeding, *frame;
- struct interface *interface = interface_first;
+ struct interface *interface;
- while (interface) {
- if (!strcmp(interface->name, p_g_interface_name))
- break;
- interface = interface->next;
- }
+ interface = getinterfacebyname(p_g_interface_name);
if (!interface) {
PERROR("Cannot find interface %s.\n", p_g_interface_name);
return;
*/
int message_bsc(struct lcr_gsm *lcr_gsm, int msg_type, void *arg)
{
- struct interface *interface = lcr_gsm->interface;
struct gsm_mncc *mncc = (struct gsm_mncc *)arg;
unsigned int callref = mncc->callref;
class Port *port;
}
if (!port) {
+ struct interface *interface;
+
if (msg_type != MNCC_SETUP_IND)
return(0);
-#if 0
- /* find gsm port */
- mISDNport = mISDNport_first;
- while(mISDNport) {
- if (mISDNport->gsm_bs)
- break;
- mISDNport = mISDNport->next;
- }
- if (!mISDNport) {
+
+ interface = getinterfacebyname(lcr_gsm->interface_name);
+ if (!interface) {
struct gsm_mncc *rej;
rej = create_mncc(MNCC_REJ_REQ, callref);
add_trace("cause", "coding", "%d", rej->cause.coding);
add_trace("cause", "location", "%d", rej->cause.location);
add_trace("cause", "value", "%d", rej->cause.value);
+ add_trace("reason", NULL, "interface %s not found", lcr_gsm->interface_name);
end_trace();
send_and_free_mncc(lcr_gsm, rej->msg_type, rej);
return 0;
}
-#endif
/* creating port object, transparent until setup with hdlc */
SPRINT(name, "%s-%d-in", interface->name, 0);
if (!(pgsm_bs = new Pgsm_bs(PORT_TYPE_GSM_BS_IN, name, NULL, interface)))
/* create gsm instance */
gsm_bs = (struct lcr_gsm *)MALLOC(sizeof(struct lcr_gsm));
- gsm_bs->interface = interface;
+ SCPY(gsm_bs->interface_name, interface->name);
gsm_bs->type = LCR_GSM_TYPE_NETWORK;
gsm_bs->sun.sun_family = AF_UNIX;
SCPY(gsm_bs->sun.sun_path, "/tmp/bsc_mncc");
class Endpoint *epoint;
struct lcr_msg *message;
struct gsm_mncc *mode, *proceeding, *frame;
- struct interface *interface = interface_first;
+ struct interface *interface;
- while (interface) {
- if (!strcmp(interface->name, p_g_interface_name))
- break;
- interface = interface->next;
- }
+ interface = getinterfacebyname(p_g_interface_name);
if (!interface) {
PERROR("Cannot find interface %s.\n", p_g_interface_name);
return;
*/
int message_ms(struct lcr_gsm *gsm_ms, int msg_type, void *arg)
{
- struct interface *interface = gsm_ms->interface;
struct gsm_mncc *mncc = (struct gsm_mncc *)arg;
unsigned int callref = mncc->callref;
class Port *port;
}
if (!port) {
+ struct interface *interface;
+
if (msg_type != MNCC_SETUP_IND)
return(0);
-#if 0
- /* find gsm ms port */
- mISDNport = mISDNport_first;
- while(mISDNport) {
- if (mISDNport->gsm_ms && !strcmp(mISDNport->ifport->gsm_ms_name, gsm_ms->name))
- break;
- mISDNport = mISDNport->next;
- }
- if (!mISDNport) {
+
+ interface = getinterfacebyname(gsm_ms->interface_name);
+ if (!interface) {
struct gsm_mncc *rej;
rej = create_mncc(MNCC_REJ_REQ, callref);
add_trace("cause", "coding", "%d", rej->cause.coding);
add_trace("cause", "location", "%d", rej->cause.location);
add_trace("cause", "value", "%d", rej->cause.value);
+ add_trace("reason", NULL, "interface %s not found", gsm_ms->interface_name);
end_trace();
send_and_free_mncc(gsm_ms, rej->msg_type, rej);
return 0;
}
-#endif
/* creating port object, transparent until setup with hdlc */
SPRINT(name, "%s-%d-in", interface->name, 0);
if (!(pgsm_ms = new Pgsm_ms(PORT_TYPE_GSM_MS_IN, name, NULL, interface)))
/* create gsm instance */
gsm_ms = (struct lcr_gsm *)MALLOC(sizeof(struct lcr_gsm));
- gsm_ms->interface = interface;
+ SCPY(gsm_ms->interface_name, interface->name);
gsm_ms->type = LCR_GSM_TYPE_MS;
SCPY(gsm_ms->name, interface->gsm_ms_name);
gsm_ms->sun.sun_family = AF_UNIX;
char suffix[64];
struct interface *interface = interface_first;
- while (interface) {
- if (!strcmp(interface->name, interface_name))
- break;
- interface = interface->next;
- }
+ interface = getinterfacebyname(interface_name);
if (!interface)
return;
}
}
+struct interface *getinterfacebyname(const char *name)
+{
+ struct interface *interface = interface_first;
+
+ while (interface) {
+ if (!strcmp(interface->name, name))
+ return interface;
+ interface = interface->next;
+ }
+
+ return NULL;
+}
+
void load_port(struct interface_port *ifport);
void doc_interface(void);
void do_screen(int out, char *id, int idsize, int *type, int *present, const char *interface_name);
+struct interface *getinterfacebyname(const char *name);
class Endpoint *epoint;
struct lcr_msg *message;
uint8_t payload_type;
- struct interface *interface = interface_first;
+ struct interface *interface;
- while (interface) {
- if (!strcmp(interface->name, inst->interface_name))
- break;
- interface = interface->next;
- }
+ interface = getinterfacebyname(inst->interface_name);
if (!interface) {
PERROR("Cannot find interface %s.\n", inst->interface_name);
return;