X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=socket_server.c;h=2fba2ebaa7d26ea0bc1f6b271c985bc32ee4325d;hp=9922dc696e9091ec6de2c4473ebade7ad2766991;hb=5463e1b62a39ce417b610584e3d34a8bc30ac15e;hpb=3a8f58ec8946b7f1683208d1cc3b054486f12e6c diff --git a/socket_server.c b/socket_server.c index 9922dc6..2fba2eb 100644 --- a/socket_server.c +++ b/socket_server.c @@ -13,13 +13,15 @@ #include #include #include +#ifdef PACKAGE_VERSION +#undef PACKAGE_VERSION +#endif #include "config.h" char socket_name[128]; int sock = -1; struct sockaddr_un sock_address; -extern unsigned int new_remote; struct admin_list *admin_first = NULL; static struct lcr_fd admin_fd; @@ -664,15 +666,18 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin) mISDNport = mISDNport->next; } if (!mISDNport) { - unsigned int remote_ref = new_remote++; union parameter param; - memset(¶m, 0, sizeof(union parameter)); - admin_message_from_lcr(mISDNport->ifport->remote, remote_ref, MESSAGE_NEWREF, ¶m); + /* create new join instance */ + join = joinremote = new JoinRemote(0, admin->remote_name, admin->sock); // must have no serial, because no endpoint is connected + if (!join) { + FATAL("No memory for remote join instance\n"); + return(-1); + } memset(¶m, 0, sizeof(union parameter)); param.disconnectinfo.location = LOCATION_PRIVATE_LOCAL; param.disconnectinfo.cause = CAUSE_RESSOURCEUNAVAIL; - admin_message_from_lcr(mISDNport->ifport->remote, remote_ref, MESSAGE_RELEASE, ¶m); + admin_message_from_lcr(joinremote->j_remote_id, joinremote->j_remote_ref, MESSAGE_RELEASE, ¶m); return 0; } /* creating port object, transparent until setup with hdlc */ @@ -697,7 +702,6 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin) if (msg->param.bchannel.type == BCHANNEL_ASSIGN_ACK || msg->param.bchannel.type == BCHANNEL_REMOVE_ACK || msg->param.bchannel.type == BCHANNEL_RELEASE) { -#warning TODO: depending on the mode (join / remoteport) forward message /* no ref, but address */ message_bchannel_from_remote(NULL, msg->param.bchannel.type, msg->param.bchannel.handle); return(0); @@ -712,7 +716,7 @@ int admin_message_to_lcr(struct admin_msg *msg, struct admin_list *admin) /* find join instance */ join = join_first; while(join) { - if (join->j_type != JOIN_TYPE_REMOTE) { + if (join->j_type == JOIN_TYPE_REMOTE) { joinremote = (class JoinRemote *)join; if (joinremote->j_remote_ref == msg->ref) break; @@ -840,6 +844,8 @@ int admin_state(struct admin_queue **responsep) interface = interface_first; while(interface) { ifport = interface->ifport; + if (!ifport) + i++; while(ifport) { i++; ifport = ifport->next; @@ -901,6 +907,18 @@ int admin_state(struct admin_queue **responsep) num = 0; while(interface) { ifport = interface->ifport; + if (!ifport) { + /* message */ + response->am[num].message = ADMIN_RESPONSE_S_INTERFACE; + /* interface */ + SCPY(response->am[num].u.i.interface_name, interface->name); + /* portnum */ + response->am[num].u.i.portnum = -100; /* indicate: no ifport */ + /* iftype */ + response->am[num].u.i.extension = interface->extension; + /* block */ + num++; + } while(ifport) { /* message */ response->am[num].message = ADMIN_RESPONSE_S_INTERFACE;