=================================================================== RCS file: /home/cvs/OpenXM/src/kan96xx/plugin/oxmisc2.c,v retrieving revision 1.12 retrieving revision 1.16 diff -u -p -r1.12 -r1.16 --- OpenXM/src/kan96xx/plugin/oxmisc2.c 2001/05/04 01:06:30 1.12 +++ OpenXM/src/kan96xx/plugin/oxmisc2.c 2002/11/08 02:54:12 1.16 @@ -1,4 +1,4 @@ -/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc2.c,v 1.11 2000/12/06 00:29:52 takayama Exp $ */ +/* $OpenXM: OpenXM/src/kan96xx/plugin/oxmisc2.c,v 1.15 2002/11/07 23:52:20 takayama Exp $ */ #include #include "ox_kan.h" #include "oxmisc2.h" /* This file requires sm1 object description. */ @@ -301,6 +301,7 @@ struct object KoxCreateClient(struct object ip, } rob = newObjectArray(N_OF_CLIENT_FIELDS); oxClientToObject(client,rob); + oxClientListUpdate(rob); return(rob); } @@ -381,6 +382,7 @@ int oxClientToObject(oxclientp client,struct object ro } putoa(rob,11,KpoInteger(client->engineByteOrder)); putoa(rob,12,KpoInteger(client->controlByteOrder)); + putoa(rob,13,KpoInteger(client->engineID)); return(0); } @@ -437,6 +439,9 @@ int oxObjectToClient(struct object ob,oxclientp cp) cp->engineByteOrder = KopInteger(ob1); ob1 = getoa(ob,12); cp->controlByteOrder = KopInteger(ob1); + + ob1 = getoa(ob,13); + cp->engineID = KopInteger(ob1); return(0); @@ -674,6 +679,7 @@ struct object KoxCloseClient(struct object client) { errorOxmisc2("Unknown client->type\n"); break; } + oxClientListRemove(client); return(KpoInteger(0)); } @@ -982,6 +988,7 @@ struct object KoxCreateClient2(struct object peer, } rob = newObjectArray(N_OF_CLIENT_FIELDS); oxClientToObject(client,rob); + oxClientListUpdate(rob); return(rob); } @@ -1113,7 +1120,6 @@ struct object KoxCreateControl_RFC_101(struct object p oxclientp oxCreateControl_RFC_101(int fdstream,int portStream, int ipmask,char *pass) { - static int clnum = 0; int v = 0; int fdControl = -1; int fdStream = -1; @@ -1121,7 +1127,11 @@ oxclientp oxCreateControl_RFC_101(int fdstream,int por char *s; oxclientp client; - extern jmp_buf MyEnv_oxmisc ; +#if defined(__CYGWIN__) + extern sigjmp_buf MyEnv_oxmisc; +#else + extern jmp_buf MyEnv_oxmisc; +#endif int engineByteOrder; extern int Quiet; @@ -1170,7 +1180,7 @@ oxclientp oxCreateControl_RFC_101(int fdstream,int por client->dataport = portStream; client->controlport = -1; client->controlfd = -1; - client->id = clnum; clnum++; + client->id = oxGetClientID(); client->type = CLIENT_SOCKET; /* socket */ client->engineByteOrder = engineByteOrder; client->controlByteOrder = -1; @@ -1222,6 +1232,7 @@ struct object KoxCreateEngine_RFC_101(struct object pe } rob = newObjectArray(N_OF_CLIENT_FIELDS); oxClientToObject(client,rob); + oxClientListUpdate(rob); return(rob); } @@ -1235,7 +1246,11 @@ oxclientp oxCreateEngine_RFC_101(int fdstream,int port char *s; oxclientp client; - extern jmp_buf MyEnv_oxmisc ; +#if defined(__CYGWIN__) + extern sigjmp_buf MyEnv_oxmisc; +#else + extern jmp_buf MyEnv_oxmisc; +#endif int engineByteOrder; extern int Quiet; @@ -1285,9 +1300,56 @@ oxclientp oxCreateEngine_RFC_101(int fdstream,int port client->dataport = portStream; client->controlport = -1; client->controlfd = -1; - client->id = engineID; + client->id = oxGetClientID(); + client->engineID = engineID; client->type = CLIENT_SOCKET; /* socket */ client->engineByteOrder = engineByteOrder; client->controlByteOrder = -1; return(client); } + +void oxClientListUpdate(struct object ob) { + int id; + extern struct object OxClientList[]; + id = KopInteger(getoa(ob,8)); + /* printf("id=%d\n",id); */ + if ((id = 0)) { + OxClientList[id] = ob; + }else{ + errorOxmisc2("oxClientListUpdate(): the client table is full.\n"); + } +} +void oxClientListRemove(struct object ob) { + int id; + extern struct object OxClientList[]; + id = KopInteger(getoa(ob,8)); + if ((id = 0)) { + (OxClientList[id]).tag = Snull; + }else{ + /* errorOxmisc2("oxClientListRemove(): the client table is full.\n");*/ + } +} +struct object KoxGetClientList() { + extern int OxClientListn; + extern struct object OxClientList[]; + int i,j,n; + struct object rob; + n = 0; + for (i=0; i= n) { + j=0; + errorOxmisc2("oxGetClientList(): the client table is broken.\n"); + } + putoa(rob,j,OxClientList[i]); + j++; + } + } + return rob; +} + +