X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=socket_server.c;h=9a774b66ff9df94b65a94ce369ec361939b953a8;hp=9922dc696e9091ec6de2c4473ebade7ad2766991;hb=e9c834b844aa57b0af09c702c455d5b558b151d5;hpb=3a8f58ec8946b7f1683208d1cc3b054486f12e6c diff --git a/socket_server.c b/socket_server.c index 9922dc6..9a774b6 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;