added access control and ring buffers
This commit is contained in:
1935
src/ca/access.c
1935
src/ca/access.c
File diff suppressed because it is too large
Load Diff
370
src/ca/acctst.c
370
src/ca/acctst.c
@@ -1,59 +1,65 @@
|
||||
static char *sccsId = "@(#)acctst.c 1.8\t2/19/93";
|
||||
|
||||
/*
|
||||
* CA test/debug routine
|
||||
*/
|
||||
|
||||
#if 1
|
||||
#define CA_TEST_CHNL "fredy"
|
||||
#define CA_TEST_CHNL4 "fredy"
|
||||
#else
|
||||
#if 0
|
||||
#define CA_TEST_CHNL "ts2:ai0"
|
||||
#define CA_TEST_CHNL4 "ts2:ai0"
|
||||
#else
|
||||
#define CA_TEST_CHNL "mv16z:ai1"
|
||||
#define CA_TEST_CHNL4 "mv16z:ai1"
|
||||
#endif
|
||||
#endif
|
||||
static char *sccsId = "$Id$";
|
||||
|
||||
|
||||
/* System includes */
|
||||
#if defined(UNIX)
|
||||
# include <stdio.h>
|
||||
#else
|
||||
# if defined(vxWorks)
|
||||
# include <vxWorks.h>
|
||||
# include <taskLib.h>
|
||||
# include <stdio.h>
|
||||
# endif
|
||||
#endif
|
||||
#ifdef UNIX
|
||||
#include <stdio.h>
|
||||
#endif /*UNIX*/
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <vxWorks.h>
|
||||
#include <taskLib.h>
|
||||
#include <stdio.h>
|
||||
#endif /*vxWorks*/
|
||||
|
||||
#include <cadef.h>
|
||||
#include <db_access.h>
|
||||
#include <os_depen.h>
|
||||
|
||||
|
||||
/*
|
||||
* #define EVENT_ROUTINE ca_test_event #define CONN_ROUTINE NULL
|
||||
*/
|
||||
#define EVENT_ROUTINE null_event
|
||||
#define CONN_ROUTINE conn
|
||||
|
||||
#define NUM 1
|
||||
|
||||
#ifdef __STDC__
|
||||
int doacctst(char *pname);
|
||||
void test_sync_groups(chid chix);
|
||||
void multiple_sg_requests(chid chix, CA_SYNC_GID gid);
|
||||
void null_event(struct event_handler_args args);
|
||||
void write_event(struct event_handler_args args);
|
||||
void conn(struct connection_handler_args args);
|
||||
#else /*__STDC__*/
|
||||
int doacctst();
|
||||
void test_sync_groups();
|
||||
void multiple_sg_requests();
|
||||
void null_event();
|
||||
void write_event();
|
||||
void conn();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
|
||||
#ifdef vxWorks
|
||||
int spacctst()
|
||||
#ifdef __STDC__
|
||||
int acctst(char *pname)
|
||||
#else /*__STDC__*/
|
||||
int acctst(pname)
|
||||
char *pname;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
int acctst();
|
||||
|
||||
return taskSpawn(
|
||||
"acctst",
|
||||
200,
|
||||
VX_FP_TASK,
|
||||
20000,
|
||||
acctst,
|
||||
NULL,
|
||||
doacctst,
|
||||
(int)pname,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
@@ -64,21 +70,39 @@ int spacctst()
|
||||
NULL,
|
||||
NULL);
|
||||
}
|
||||
#endif
|
||||
#endif /*vxWorks*/
|
||||
|
||||
#ifdef UNIX
|
||||
#ifdef __STDC__
|
||||
main(int argc, char **argv)
|
||||
#else /*__STDC__*/
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
if(argc == 2){
|
||||
doacctst(argv[1]);
|
||||
}
|
||||
else{
|
||||
printf("usage: %s <chan name>\n", argv[0]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif /*UNIX*/
|
||||
|
||||
|
||||
#ifdef vxWorks
|
||||
int acctst()
|
||||
#else
|
||||
main()
|
||||
#endif
|
||||
#ifdef __STDC__
|
||||
int doacctst(char *pname)
|
||||
#else /*__STDC__*/
|
||||
int doacctst(pname)
|
||||
char *pname;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
chid chix1;
|
||||
chid chix2;
|
||||
chid chix3;
|
||||
chid chix4;
|
||||
void ca_test_event();
|
||||
void null_event();
|
||||
struct dbr_gr_float *ptr;
|
||||
struct dbr_gr_float *pgrfloat;
|
||||
long status;
|
||||
@@ -87,8 +111,6 @@ main()
|
||||
float *pfloat;
|
||||
double *pdouble;
|
||||
char pstring[NUM][MAX_STRING_SIZE];
|
||||
void write_event();
|
||||
void conn();
|
||||
|
||||
|
||||
SEVCHK(ca_task_initialize(), "Unable to initialize");
|
||||
@@ -96,15 +118,14 @@ main()
|
||||
printf("begin\n");
|
||||
#ifdef VMS
|
||||
lib$init_timer();
|
||||
#endif
|
||||
#endif /*VMS*/
|
||||
|
||||
ptr = (struct dbr_gr_float *)
|
||||
malloc(dbr_size[DBR_GR_FLOAT] +
|
||||
dbr_value_size[DBR_GR_FLOAT] * (NUM - 1));
|
||||
malloc(dbr_size_n(DBR_GR_FLOAT, NUM));
|
||||
|
||||
for (i = 0; i < 10; i++) {
|
||||
|
||||
status = ca_array_build(CA_TEST_CHNL, /* channel ASCII name */
|
||||
status = ca_array_build(pname, /* channel ASCII name */
|
||||
DBR_GR_FLOAT, /* fetch external type */
|
||||
NUM, /* array element cnt */
|
||||
&chix3, /* ptr to chid */
|
||||
@@ -113,28 +134,28 @@ main()
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL4,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix4,
|
||||
NULL,
|
||||
CONN_ROUTINE,
|
||||
NULL,
|
||||
NULL), NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix2,
|
||||
NULL,
|
||||
CONN_ROUTINE,
|
||||
NULL,
|
||||
NULL), NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix1,
|
||||
NULL,
|
||||
CONN_ROUTINE,
|
||||
NULL,
|
||||
NULL), NULL);
|
||||
|
||||
printf("IO status is: %s\n",ca_message(ca_test_io()));
|
||||
@@ -143,9 +164,10 @@ main()
|
||||
printf("chix2 is on %s\n", ca_host_name(chix2));
|
||||
printf("chix4 is on %s\n", ca_host_name(chix4));
|
||||
|
||||
status = ca_pend_io(10.0);
|
||||
status = ca_pend_io(1000.0);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
|
||||
printf("IO status is: %s\n",ca_message(ca_test_io()));
|
||||
|
||||
printf("chix1 is on %s\n", ca_host_name(chix1));
|
||||
@@ -153,14 +175,14 @@ main()
|
||||
printf("chix4 is on %s\n", ca_host_name(chix4));
|
||||
|
||||
SEVCHK(ca_clear_channel(chix4), NULL);
|
||||
SEVCHK(ca_clear_channel(chix2), NULL);
|
||||
SEVCHK(ca_clear_channel(chix3), NULL);
|
||||
SEVCHK(ca_clear_channel(chix2), NULL);
|
||||
SEVCHK(ca_clear_channel(chix1), NULL);
|
||||
|
||||
}
|
||||
|
||||
status = ca_array_build(
|
||||
CA_TEST_CHNL, /* channel ASCII name */
|
||||
pname, /* channel ASCII name */
|
||||
DBR_GR_FLOAT, /* fetch external type */
|
||||
NUM, /* array element cnt */
|
||||
&chix3, /* ptr to chid */
|
||||
@@ -169,7 +191,7 @@ main()
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL4,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix4,
|
||||
@@ -177,7 +199,7 @@ main()
|
||||
CONN_ROUTINE,
|
||||
NULL), NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix2,
|
||||
@@ -185,7 +207,7 @@ main()
|
||||
CONN_ROUTINE,
|
||||
NULL), NULL);
|
||||
SEVCHK(ca_build_and_connect(
|
||||
CA_TEST_CHNL,
|
||||
pname,
|
||||
TYPENOTCONN,
|
||||
0,
|
||||
&chix1,
|
||||
@@ -193,24 +215,24 @@ main()
|
||||
CONN_ROUTINE,
|
||||
NULL), NULL);
|
||||
|
||||
status = ca_pend_io(10.0);
|
||||
status = ca_pend_io(1000.0);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
if (INVALID_DB_REQ(chix1->type))
|
||||
printf("Failed to locate %s\n", CA_TEST_CHNL);
|
||||
printf("Failed to locate %s\n", pname);
|
||||
if (INVALID_DB_REQ(chix2->type))
|
||||
printf("Failed to locate %s\n", CA_TEST_CHNL);
|
||||
printf("Failed to locate %s\n", pname);
|
||||
if (INVALID_DB_REQ(chix3->type))
|
||||
printf("Failed to locate %s\n", CA_TEST_CHNL);
|
||||
printf("Failed to locate %s\n", pname);
|
||||
if (INVALID_DB_REQ(chix4->type))
|
||||
printf("Failed to locate %s\n", CA_TEST_CHNL4);
|
||||
printf("Failed to locate %s\n", pname);
|
||||
/*
|
||||
* SEVCHK(status,NULL); if(status == ECA_TIMEOUT) exit();
|
||||
*/
|
||||
|
||||
#ifdef VMS
|
||||
lib$show_timer();
|
||||
#endif
|
||||
#endif /*VMS*/
|
||||
|
||||
pfloat = &ptr->value;
|
||||
for (i = 0; i < NUM; i++)
|
||||
@@ -218,7 +240,7 @@ main()
|
||||
|
||||
#ifdef VMS
|
||||
lib$init_timer();
|
||||
#endif
|
||||
#endif /*VMS*/
|
||||
|
||||
/*
|
||||
* verify we dont jam up on many uninterrupted
|
||||
@@ -227,24 +249,84 @@ main()
|
||||
printf("Performing multiple get test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif
|
||||
#endif /*UNIX*/
|
||||
{
|
||||
struct dbr_ctrl_float temp;
|
||||
float temp;
|
||||
for(i=0; i<10000; i++){
|
||||
|
||||
SEVCHK(ca_get(DBR_GR_FLOAT, chix4, &temp),NULL);
|
||||
SEVCHK(ca_get(DBR_FLOAT, chix4, &temp),NULL);
|
||||
}
|
||||
SEVCHK(ca_pend_io(200.0), NULL);
|
||||
SEVCHK(ca_pend_io(2000.0), NULL);
|
||||
}
|
||||
printf("done.\n");
|
||||
|
||||
/*
|
||||
* verify we dont jam up on many uninterrupted requests
|
||||
*/
|
||||
printf("Performing multiple put test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif /*UNIX*/
|
||||
for(i=0; i<10000; i++){
|
||||
double fval = 3.3;
|
||||
status = ca_put(DBR_DOUBLE, chix4, &fval);
|
||||
SEVCHK(status, NULL);
|
||||
}
|
||||
SEVCHK(ca_pend_io(2000.0), NULL);
|
||||
printf("done.\n");
|
||||
|
||||
/*
|
||||
* verify we dont jam up on many uninterrupted
|
||||
* solicitations
|
||||
*/
|
||||
printf("Performing multiple get callback test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif /*UNIX*/
|
||||
for(i=0; i<10000; i++){
|
||||
status = ca_array_get_callback(
|
||||
DBR_FLOAT,
|
||||
1,
|
||||
chix1,
|
||||
null_event,
|
||||
NULL);
|
||||
|
||||
SEVCHK(status, NULL);
|
||||
}
|
||||
SEVCHK(ca_flush_io(), NULL);
|
||||
printf("done.\n");
|
||||
|
||||
test_sync_groups(chix1);
|
||||
|
||||
/*
|
||||
* verify we dont jam up on many uninterrupted
|
||||
* solicitations
|
||||
*/
|
||||
printf("Performing multiple put callback test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif /*UNIX*/
|
||||
for(i=0; i<10000; i++){
|
||||
float fval = 3.3;
|
||||
status = ca_array_put_callback(
|
||||
DBR_FLOAT,
|
||||
1,
|
||||
chix1,
|
||||
&fval,
|
||||
null_event,
|
||||
NULL);
|
||||
|
||||
SEVCHK(status, NULL);
|
||||
}
|
||||
SEVCHK(ca_flush_io(), NULL);
|
||||
printf("done.\n");
|
||||
|
||||
/*
|
||||
* verify we can add many monitors at once
|
||||
*/
|
||||
printf("Performing multiple monitor test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif
|
||||
#endif /*UNIX*/
|
||||
{
|
||||
evid mid[1000];
|
||||
float temp;
|
||||
@@ -258,7 +340,7 @@ main()
|
||||
* complete
|
||||
*/
|
||||
SEVCHK(ca_get(DBR_FLOAT,chix4,&temp),NULL);
|
||||
SEVCHK(ca_pend_io(100.0),NULL);
|
||||
SEVCHK(ca_pend_io(1000.0),NULL);
|
||||
|
||||
for(i=0; i<NELEMENTS(mid); i++){
|
||||
SEVCHK(ca_clear_event(mid[i]),NULL);
|
||||
@@ -269,7 +351,7 @@ main()
|
||||
* complete
|
||||
*/
|
||||
SEVCHK(ca_get(DBR_FLOAT,chix4,&temp),NULL);
|
||||
SEVCHK(ca_pend_io(100.0),NULL);
|
||||
SEVCHK(ca_pend_io(1000.0),NULL);
|
||||
}
|
||||
printf("done.\n");
|
||||
|
||||
@@ -354,11 +436,11 @@ main()
|
||||
else
|
||||
abort(0);
|
||||
|
||||
SEVCHK(ca_pend_io(4.0), NULL);
|
||||
SEVCHK(ca_pend_io(4000.0), NULL);
|
||||
|
||||
#ifdef VMS
|
||||
lib$show_timer();
|
||||
#endif
|
||||
#endif /*VMS*/
|
||||
for (i = 0; i < NUM; i++) {
|
||||
printf("Float value Returned from put/get %f\n", pfloat[i]);
|
||||
printf("Double value Returned from put/get %f\n", pdouble[i]);
|
||||
@@ -368,8 +450,12 @@ main()
|
||||
for (i = 0; i < 10; i++)
|
||||
ca_get_callback(DBR_GR_FLOAT, chix1, ca_test_event, NULL);
|
||||
|
||||
|
||||
SEVCHK(ca_modify_client_name("Willma"), NULL);
|
||||
SEVCHK(ca_modify_client_location("Bed Rock"), NULL);
|
||||
|
||||
printf("-- Put/Gets done- waiting for Events --\n");
|
||||
status = ca_pend_event(60.0);
|
||||
status = ca_pend_event(2000.0);
|
||||
if (status == ECA_TIMEOUT) {
|
||||
|
||||
free(ptr);
|
||||
@@ -380,15 +466,20 @@ main()
|
||||
} else
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
status = ca_task_exit();
|
||||
SEVCHK(status,NULL);
|
||||
|
||||
return(0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void
|
||||
null_event()
|
||||
#ifdef __STDC__
|
||||
void null_event(struct event_handler_args args)
|
||||
#else /*__STDC__*/
|
||||
void null_event(args)
|
||||
struct event_handler_args args;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
static int i;
|
||||
|
||||
@@ -399,25 +490,33 @@ null_event()
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
write_event(args)
|
||||
struct event_handler_args args;
|
||||
#ifdef __STDC__
|
||||
void write_event(struct event_handler_args args)
|
||||
#else /*__STDC__*/
|
||||
void write_event(args)
|
||||
struct event_handler_args args;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
int status;
|
||||
float a = *(float *) args.dbr;
|
||||
|
||||
a += 10.1;
|
||||
|
||||
SEVCHK(ca_rput(args.chid, &a), "write fail in event");
|
||||
status = ca_array_put(
|
||||
DBR_FLOAT,
|
||||
1,
|
||||
args.chid,
|
||||
&a);
|
||||
SEVCHK(status,NULL);
|
||||
SEVCHK(ca_flush_io(), NULL);
|
||||
/*
|
||||
* #ifdef vxWorks taskDelay(20); #endif
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
void
|
||||
conn(args)
|
||||
struct connection_handler_args args;
|
||||
#ifdef __STDC__
|
||||
void conn(struct connection_handler_args args)
|
||||
#else /*__STDC__*/
|
||||
void conn(args)
|
||||
struct connection_handler_args args;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
|
||||
if (args.op == CA_OP_CONN_UP)
|
||||
@@ -427,3 +526,98 @@ conn(args)
|
||||
else
|
||||
printf("Ukn conn ev\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* test_sync_groups()
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
void test_sync_groups(chid chix)
|
||||
#else /*__STDC__*/
|
||||
void test_sync_groups(chix)
|
||||
chid chix;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
int status;
|
||||
CA_SYNC_GID gid1;
|
||||
CA_SYNC_GID gid2;
|
||||
|
||||
printf("Performing sync group test...");
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif /*UNIX*/
|
||||
|
||||
status = ca_sg_create(&gid1);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
multiple_sg_requests(chix, gid1);
|
||||
status = ca_sg_reset(gid1);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
status = ca_sg_create(&gid2);
|
||||
SEVCHK(status, NULL);
|
||||
multiple_sg_requests(chix, gid2);
|
||||
multiple_sg_requests(chix, gid1);
|
||||
status = ca_sg_test(gid2);
|
||||
SEVCHK(status, "SYNC GRP2");
|
||||
status = ca_sg_test(gid1);
|
||||
SEVCHK(status, "SYNC GRP1");
|
||||
status = ca_sg_block(gid1, 15.0);
|
||||
SEVCHK(status, "SYNC GRP1");
|
||||
status = ca_sg_block(gid2, 15.0);
|
||||
SEVCHK(status, "SYNC GRP2");
|
||||
status = ca_sg_delete(gid2);
|
||||
SEVCHK(status, NULL);
|
||||
status = ca_sg_create(&gid2);
|
||||
SEVCHK(status, NULL);
|
||||
multiple_sg_requests(chix, gid1);
|
||||
multiple_sg_requests(chix, gid2);
|
||||
status = ca_sg_block(gid1, 15.0);
|
||||
SEVCHK(status, "SYNC GRP1");
|
||||
status = ca_sg_block(gid2, 15.0);
|
||||
SEVCHK(status, "SYNC GRP2");
|
||||
status = ca_sg_delete(gid1);
|
||||
SEVCHK(status, NULL);
|
||||
status = ca_sg_delete(gid2);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
printf("done\n");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* multiple_sg_requests()
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
void multiple_sg_requests(chid chix, CA_SYNC_GID gid)
|
||||
#else /*__STDC__*/
|
||||
void multiple_sg_requests(chix, gid)
|
||||
chid chix;
|
||||
CA_SYNC_GID gid;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
int status;
|
||||
unsigned i;
|
||||
static float fvalput = 3.3;
|
||||
static float fvalget;
|
||||
|
||||
for(i=0; i<1000; i++){
|
||||
status = ca_sg_array_put(
|
||||
gid,
|
||||
DBR_FLOAT,
|
||||
1,
|
||||
chix,
|
||||
&fvalput);
|
||||
SEVCHK(status, NULL);
|
||||
|
||||
status = ca_sg_array_get(
|
||||
gid,
|
||||
DBR_FLOAT,
|
||||
1,
|
||||
chix,
|
||||
&fvalget);
|
||||
SEVCHK(status, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,12 +36,12 @@ static char *sccsId = "$Id$";
|
||||
|
||||
#if defined(UNIX) || defined(VMS)
|
||||
# include <stdio.h>
|
||||
#else
|
||||
# if defined(vxWorks)
|
||||
#endif
|
||||
#if defined(vxWorks)
|
||||
# include <vxWorks.h>
|
||||
# include <logLib.h>
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
#else
|
||||
@@ -85,8 +85,9 @@ va_dcl
|
||||
pformat,
|
||||
args);
|
||||
}
|
||||
#else
|
||||
# if defined(vxWorks)
|
||||
#endif
|
||||
|
||||
#ifdef vxWorks
|
||||
{
|
||||
int logMsgArgs[6];
|
||||
int i;
|
||||
@@ -105,9 +106,6 @@ va_dcl
|
||||
logMsgArgs[5]);
|
||||
|
||||
}
|
||||
# else
|
||||
#### dont compile in this case ####
|
||||
# endif
|
||||
#endif
|
||||
|
||||
va_end(args);
|
||||
|
||||
@@ -71,8 +71,6 @@ static char *sccsId = "$Id$\t$Date$";
|
||||
* retry disconnected channels
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* Lock must be applied while in this routine
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
void manage_conn(int silent)
|
||||
@@ -93,6 +91,7 @@ int silent;
|
||||
/*
|
||||
* issue connection heartbeat
|
||||
*/
|
||||
LOCK;
|
||||
for( piiu = (struct ioc_in_use *) iiuList.node.next;
|
||||
piiu;
|
||||
piiu = (struct ioc_in_use *) piiu->node.next){
|
||||
@@ -120,6 +119,7 @@ int silent;
|
||||
noop_msg(piiu);
|
||||
keepalive_cnt++;
|
||||
}
|
||||
UNLOCK;
|
||||
|
||||
if(!piiuCast){
|
||||
return;
|
||||
@@ -140,8 +140,11 @@ int silent;
|
||||
}
|
||||
piiuCast->next_retry = current + piiuCast->retry_delay;
|
||||
|
||||
chix = (chid) &piiuCast->chidlist.node.next;
|
||||
while(chix = (chid) chix->node.next){
|
||||
LOCK;
|
||||
for( chix = (chid) piiuCast->chidlist.node.next;
|
||||
chix;
|
||||
chix = (chid) chix->node.next){
|
||||
|
||||
build_msg(chix, DONTREPLY);
|
||||
retry_cnt++;
|
||||
|
||||
@@ -150,15 +153,15 @@ int silent;
|
||||
retry_cnt_no_handler++;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
|
||||
if(retry_cnt){
|
||||
#ifdef TRYING_MESSAGE
|
||||
ca_printf("<Trying %d> ", retry_cnt);
|
||||
#ifdef UNIX
|
||||
fflush(stdout);
|
||||
#endif UNIX
|
||||
#endif TRYING_MESSAGE
|
||||
#endif /*UNIX*/
|
||||
#endif /*TRYING_MESSAGE*/
|
||||
|
||||
if(!silent && retry_cnt_no_handler){
|
||||
sprintf(sprintf_buf, "%d channels outstanding", retry_cnt);
|
||||
@@ -174,8 +177,6 @@ int silent;
|
||||
* MARK_SERVER_AVAILABLE
|
||||
*
|
||||
*
|
||||
* NOTES:
|
||||
* Lock must be applied while in this routine
|
||||
*
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
@@ -208,6 +209,7 @@ struct in_addr *pnet_addr;
|
||||
*/
|
||||
index = ntohl(pnet_addr->s_addr);
|
||||
index &= BHT_INET_ADDR_MASK;
|
||||
LOCK;
|
||||
pBHE = ca_static->ca_beaconHash[index];
|
||||
while(pBHE){
|
||||
if(pBHE->inetAddr.s_addr ==
|
||||
@@ -256,6 +258,7 @@ struct in_addr *pnet_addr;
|
||||
}
|
||||
|
||||
if(!netChange){
|
||||
UNLOCK;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -264,8 +267,9 @@ struct in_addr *pnet_addr;
|
||||
/*
|
||||
* create the hash entry
|
||||
*/
|
||||
pBHE = (bhe *)malloc(sizeof(*pBHE));
|
||||
pBHE = (bhe *)calloc(1,sizeof(*pBHE));
|
||||
if(!pBHE){
|
||||
UNLOCK;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -311,7 +315,7 @@ struct in_addr *pnet_addr;
|
||||
*/
|
||||
{
|
||||
struct sockaddr_in saddr;
|
||||
unsigned saddr_length = sizeof(saddr);
|
||||
int saddr_length = sizeof(saddr);
|
||||
int status;
|
||||
|
||||
status = getsockname(
|
||||
@@ -345,5 +349,6 @@ struct in_addr *pnet_addr;
|
||||
fflush(stdout);
|
||||
#endif
|
||||
#endif
|
||||
UNLOCK;
|
||||
|
||||
}
|
||||
|
||||
1819
src/ca/convert.c
1819
src/ca/convert.c
File diff suppressed because it is too large
Load Diff
@@ -86,6 +86,8 @@ struct ioc_in_use *piiu;
|
||||
register int status;
|
||||
register int busy = piiu->client_busy;
|
||||
|
||||
LOCK;
|
||||
|
||||
/*
|
||||
* use of the additional system call here does not
|
||||
* seem to slow things down appreciably
|
||||
@@ -94,8 +96,7 @@ struct ioc_in_use *piiu;
|
||||
FIONREAD,
|
||||
(int)&nbytes);
|
||||
if (status < 0) {
|
||||
LOCK;
|
||||
close_ioc(piiu);
|
||||
piiu->conn_up = FALSE;
|
||||
UNLOCK;
|
||||
return;
|
||||
}
|
||||
@@ -111,7 +112,7 @@ struct ioc_in_use *piiu;
|
||||
MAX_CONTIGUOUS_MSG_COUNT) {
|
||||
piiu->client_busy = TRUE;
|
||||
ca_busy_message(piiu);
|
||||
# if DEBUG
|
||||
# ifdef DEBUG
|
||||
printf("fc on\n");
|
||||
# endif
|
||||
}
|
||||
@@ -126,5 +127,7 @@ struct ioc_in_use *piiu;
|
||||
}
|
||||
}
|
||||
|
||||
UNLOCK;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
1469
src/ca/iocinf.c
1469
src/ca/iocinf.c
File diff suppressed because it is too large
Load Diff
250
src/ca/iocinf.h
250
src/ca/iocinf.h
@@ -26,7 +26,8 @@
|
||||
/* .15 112092 joh added AST lck count var for VMS */
|
||||
/* .16 120992 joh switched to dll list routines */
|
||||
/* .17 121892 joh added TCP send buf size var */
|
||||
/* .17 122192 joh added outstanding ack var */
|
||||
/* .18 122192 joh added outstanding ack var */
|
||||
/* .19 012094 joh added minor version (for each server) */
|
||||
/* */
|
||||
/*_begin */
|
||||
/************************************************************************/
|
||||
@@ -74,6 +75,11 @@ static char *iocinfhSccsId = "$Id$";
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include <cadef.h>
|
||||
#include <iocmsg.h>
|
||||
#include <bucketLib.h>
|
||||
#include <ellLib.h>
|
||||
#include <os_depen.h>
|
||||
@@ -82,6 +88,20 @@ static char *iocinfhSccsId = "$Id$";
|
||||
#define min(A,B) ((A)>(B)?(B):(A))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* catch when they use really large strings
|
||||
*/
|
||||
#define STRING_LIMIT 512
|
||||
|
||||
#define INITCHK \
|
||||
if(!ca_static){ \
|
||||
int s; \
|
||||
s = ca_task_initialize(); \
|
||||
if(s != ECA_NORMAL){ \
|
||||
return s; \
|
||||
} \
|
||||
}
|
||||
|
||||
/* throw out requests prior to last ECA_TIMEOUT from ca_pend */
|
||||
#define VALID_MSG(PIIU) (piiu->read_seq == piiu->cur_read_seq)
|
||||
|
||||
@@ -92,25 +112,21 @@ static char *iocinfhSccsId = "$Id$";
|
||||
#define SETPENDRECV {pndrecvcnt++;}
|
||||
#define CLRPENDRECV(LOCK) {if(--pndrecvcnt<1){cac_io_done(LOCK); POST_IO_EV;}}
|
||||
|
||||
/************************************************************************/
|
||||
/* Structures */
|
||||
/************************************************************************/
|
||||
/* stk must be above and contiguous with buf ! */
|
||||
struct buffer{
|
||||
char buf[MAX_MSG_SIZE]; /* from iocmsg.h */
|
||||
unsigned long stk;
|
||||
|
||||
struct udpmsglog{
|
||||
long nbytes;
|
||||
int valid;
|
||||
struct sockaddr_in addr;
|
||||
};
|
||||
|
||||
|
||||
/* indexs into the ioc in use table */
|
||||
#if 0
|
||||
#define INVALID_IIU (MAXIIU+1)
|
||||
#define LOCAL_IIU (MAXIIU+100)
|
||||
#define BROADCAST_IIU 0
|
||||
#endif
|
||||
/*
|
||||
* for use with ca_mux_io()
|
||||
*/
|
||||
#define CA_DO_SENDS 1
|
||||
#define CA_DO_RECVS 2
|
||||
|
||||
struct pending_io_event{
|
||||
ELLNODE node;
|
||||
ELLNODE node;
|
||||
void (*io_done_sub)();
|
||||
void *io_done_arg;
|
||||
};
|
||||
@@ -135,9 +151,23 @@ typedef struct beaconHashEntry{
|
||||
int averagePeriod;
|
||||
}bhe;
|
||||
|
||||
#ifdef vxWorks
|
||||
typedef struct caclient_put_notify{
|
||||
ELLNODE node;
|
||||
PUTNOTIFY dbPutNotify;
|
||||
unsigned long valueSize; /* size of block pointed to by dbPutNotify */
|
||||
void (*caUserCallback)(struct event_handler_args);
|
||||
void *caUserArg;
|
||||
struct ca_static *pcas;
|
||||
int busy;
|
||||
}CACLIENTPUTNOTIFY;
|
||||
#endif /*vxWorks*/
|
||||
|
||||
#define MAX_CONTIGUOUS_MSG_COUNT 2
|
||||
|
||||
/*
|
||||
* ! lock needs to be applied when an id is allocated !
|
||||
*/
|
||||
#define CLIENT_ID_WIDTH 20 /* bits (1 million before rollover) */
|
||||
#define CLIENT_ID_COUNT (1<<CLIENT_ID_WIDTH)
|
||||
#define CLIENT_ID_MASK (CLIENT_ID_COUNT-1)
|
||||
@@ -156,6 +186,7 @@ typedef struct beaconHashEntry{
|
||||
#define nxtiiu (ca_static->ca_nxtiiu)
|
||||
#define free_event_list (ca_static->ca_free_event_list)
|
||||
#define pend_read_list (ca_static->ca_pend_read_list)
|
||||
#define pend_write_list (ca_static->ca_pend_write_list)
|
||||
#define fd_register_func\
|
||||
(ca_static->ca_fd_register_func)
|
||||
#define fd_register_arg (ca_static->ca_fd_register_arg)
|
||||
@@ -168,7 +199,6 @@ typedef struct beaconHashEntry{
|
||||
#if defined(UNIX) || defined(vxWorks)
|
||||
# define readch (ca_static->ca_readch)
|
||||
# define writech (ca_static->ca_writech)
|
||||
# define excepch (ca_static->ca_excepch)
|
||||
#endif
|
||||
|
||||
#if defined(UNIX)
|
||||
@@ -201,23 +231,68 @@ typedef struct task_var_list{
|
||||
int tid;
|
||||
}TVIU;
|
||||
|
||||
|
||||
/*
|
||||
* Ring buffering for both sends and recvs
|
||||
*/
|
||||
struct ca_buffer{
|
||||
char buf[MAX_MSG_SIZE]; /* from iocmsg.h */
|
||||
unsigned long max_msg;
|
||||
unsigned long rdix;
|
||||
unsigned long wtix;
|
||||
int readLast;
|
||||
};
|
||||
|
||||
#define CAC_RING_BUFFER_INIT(PRBUF, SIZE) \
|
||||
assert((SIZE)>sizeof((PRBUF)->buf)); \
|
||||
(PRBUF)->max_msg = (SIZE); \
|
||||
(PRBUF)->rdix = 0; \
|
||||
(PRBUF)->wtix = 0; \
|
||||
(PRBUF)->readLast = TRUE;
|
||||
|
||||
#define CAC_RING_BUFFER_READ_ADVANCE(PRBUF, DELTA) \
|
||||
( (PRBUF)->readLast = TRUE, \
|
||||
((PRBUF)->rdix += (DELTA)) >= (PRBUF)->max_msg ? \
|
||||
(PRBUF)->rdix = 0 : \
|
||||
(PRBUF)->rdix \
|
||||
)
|
||||
|
||||
#define CAC_RING_BUFFER_WRITE_ADVANCE(PRBUF, DELTA) \
|
||||
( (PRBUF)->readLast = FALSE, \
|
||||
((PRBUF)->wtix += (DELTA)) >= (PRBUF)->max_msg ? \
|
||||
(PRBUF)->wtix = 0 : \
|
||||
(PRBUF)->wtix \
|
||||
)
|
||||
|
||||
/*
|
||||
* One per IOC
|
||||
*/
|
||||
typedef struct ioc_in_use{
|
||||
ELLNODE node;
|
||||
unsigned outstanding_ack_count;
|
||||
unsigned bytes_pushing_an_ack;
|
||||
struct ca_static *pcas;
|
||||
unsigned minor_version_number;
|
||||
unsigned contiguous_msg_count;
|
||||
unsigned client_busy;
|
||||
char active;
|
||||
int sock_proto;
|
||||
struct sockaddr_in sock_addr;
|
||||
int sock_chan;
|
||||
int max_msg;
|
||||
int tcp_send_buff_size;
|
||||
struct buffer *send;
|
||||
struct buffer *recv;
|
||||
struct ca_buffer send;
|
||||
struct ca_buffer recv;
|
||||
struct extmsg curMsg;
|
||||
unsigned curMsgBytes;
|
||||
void *pCurData;
|
||||
unsigned long curDataMax;
|
||||
unsigned long curDataBytes;
|
||||
#ifdef __STDC__
|
||||
void (*sendBytes)(struct ioc_in_use *);
|
||||
void (*recvBytes)(struct ioc_in_use *);
|
||||
void (*procInput)(struct ioc_in_use *);
|
||||
#else /*__STDC__*/
|
||||
void (*sendBytes)();
|
||||
void (*recvBytes)();
|
||||
void (*procInput)();
|
||||
#endif /*__STDC__*/
|
||||
unsigned read_seq;
|
||||
unsigned cur_read_seq;
|
||||
ELLLIST chidlist; /* chans on this connection */
|
||||
@@ -228,26 +303,35 @@ typedef struct ioc_in_use{
|
||||
unsigned send_retry_count;
|
||||
ca_time next_retry;
|
||||
ca_time retry_delay;
|
||||
#if defined(VMS) /* for qio ASTs */
|
||||
|
||||
#ifdef VMS /* for qio ASTs */
|
||||
unsigned long putConvertBufSize;
|
||||
void *pPutConvertBuf;
|
||||
struct sockaddr_in recvfrom;
|
||||
struct iosb iosb;
|
||||
#else
|
||||
#if defined(UNIX)
|
||||
#else
|
||||
#if defined(vxWorks)
|
||||
#else
|
||||
DONT_COMPILE
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#endif /*VMS*/
|
||||
|
||||
#ifdef UNIX
|
||||
#endif /*UNIX*/
|
||||
|
||||
#ifdef vxWorks
|
||||
#endif /*vxWorks*/
|
||||
|
||||
}IIU;
|
||||
|
||||
|
||||
struct ca_static{
|
||||
IIU *ca_piiuCast;
|
||||
ELLLIST ca_iiuList;
|
||||
long ca_pndrecvcnt;
|
||||
ELLLIST ca_ioeventlist;
|
||||
ELLLIST ca_free_event_list;
|
||||
ELLLIST ca_pend_read_list;
|
||||
ELLLIST ca_pend_write_list;
|
||||
ELLLIST activeCASG;
|
||||
ELLLIST freeCASG;
|
||||
ELLLIST activeCASGOP;
|
||||
ELLLIST freeCASGOP;
|
||||
long ca_pndrecvcnt;
|
||||
void (*ca_exception_func)();
|
||||
void *ca_exception_arg;
|
||||
void (*ca_connection_func)();
|
||||
@@ -256,18 +340,18 @@ struct ca_static{
|
||||
void *ca_fd_register_arg;
|
||||
short ca_exit_in_progress;
|
||||
unsigned short ca_post_msg_active;
|
||||
ELLLIST ca_free_event_list;
|
||||
ELLLIST ca_pend_read_list;
|
||||
short ca_repeater_contacted;
|
||||
unsigned short ca_send_msg_active;
|
||||
struct in_addr ca_castaddr;
|
||||
char ca_sprintf_buf[128];
|
||||
char ca_sprintf_buf[256];
|
||||
BUCKET *ca_pBucket;
|
||||
unsigned long ca_nextBucketId;
|
||||
bhe *ca_beaconHash[BHT_INET_ADDR_MASK+1];
|
||||
char *ca_pUserName;
|
||||
char *ca_pLocationName;
|
||||
#if defined(UNIX) || defined(vxWorks)
|
||||
fd_set ca_readch;
|
||||
fd_set ca_excepch;
|
||||
fd_set ca_writech;
|
||||
#endif
|
||||
#if defined(VMS)
|
||||
int ca_io_done_flag;
|
||||
@@ -276,13 +360,16 @@ struct ca_static{
|
||||
#endif
|
||||
#if defined(vxWorks)
|
||||
SEM_ID ca_io_done_sem;
|
||||
SEM_ID ca_blockSem;
|
||||
void *ca_evuser;
|
||||
FAST_LOCK ca_client_lock;
|
||||
FAST_LOCK ca_event_lock; /* dont allow events to preempt */
|
||||
SEM_ID ca_client_lock;
|
||||
SEM_ID ca_event_lock; /* dont allow events to preempt */
|
||||
SEM_ID ca_putNotifyLock;
|
||||
int ca_tid;
|
||||
ELLLIST ca_local_chidlist;
|
||||
ELLLIST ca_dbfree_ev_list;
|
||||
ELLLIST ca_lcl_buff_list;
|
||||
ELLLIST ca_putNotifyQue;
|
||||
int ca_event_tid;
|
||||
unsigned ca_local_ticks;
|
||||
int recv_tid;
|
||||
@@ -318,21 +405,16 @@ struct ca_static *ca_static;
|
||||
#ifdef __STDC__
|
||||
|
||||
void cac_send_msg();
|
||||
void recv_msg_select(struct timeval *ptimeout);
|
||||
void close_ioc(struct ioc_in_use *piiu);
|
||||
void ca_mux_io(struct timeval *ptimeout, int flags);
|
||||
int repeater_installed();
|
||||
void build_msg(chid chix, int reply_type);
|
||||
void ca_request_event(evid monix);
|
||||
int alloc_ioc(
|
||||
struct in_addr *pnet_addr,
|
||||
int net_proto,
|
||||
struct ioc_in_use **ppiiu
|
||||
);
|
||||
int ca_request_event(evid monix);
|
||||
void ca_busy_message(struct ioc_in_use *piiu);
|
||||
void ca_ready_message(struct ioc_in_use *piiu);
|
||||
void noop_msg(struct ioc_in_use *piiu);
|
||||
void issue_claim_channel(struct ioc_in_use *piiu, chid pchan);
|
||||
void ca_default_exception_handler(struct exception_handler_args args);
|
||||
void issue_identify_client(struct ioc_in_use *piiu);
|
||||
void issue_identify_client_location(struct ioc_in_use *piiu);
|
||||
int ca_defunct(void);
|
||||
int ca_printf(char *pformat, ...);
|
||||
void manage_conn(int silent);
|
||||
@@ -340,21 +422,47 @@ void mark_server_available(struct in_addr *pnet_addr);
|
||||
void flow_control(struct ioc_in_use *piiu);
|
||||
int broadcast_addr(struct in_addr *pcastaddr);
|
||||
int local_addr(int s, struct sockaddr_in *plcladdr);
|
||||
char *host_from_addr(struct in_addr *pnet_addr);
|
||||
int ca_repeater_task();
|
||||
void cac_recv_task(int tid);
|
||||
int post_msg(
|
||||
struct extmsg *hdrptr,
|
||||
long *pbufcnt,
|
||||
struct in_addr *pnet_addr,
|
||||
struct ioc_in_use *piiu
|
||||
);
|
||||
void cac_io_done(int lock);
|
||||
void ca_sg_init(void);
|
||||
void ca_sg_shutdown(struct ca_static *ca_temp);
|
||||
int ca_select_io(struct timeval *ptimeout, int flags);
|
||||
|
||||
#else
|
||||
void host_from_addr(
|
||||
struct in_addr *pnet_addr,
|
||||
char *pBuf,
|
||||
unsigned size
|
||||
);
|
||||
int post_msg(
|
||||
struct ioc_in_use *piiu,
|
||||
struct in_addr *pnet_addr,
|
||||
char *pInBuf,
|
||||
unsigned long blockSize
|
||||
);
|
||||
int alloc_ioc(
|
||||
struct in_addr *pnet_addr,
|
||||
int net_proto,
|
||||
struct ioc_in_use **ppiiu
|
||||
);
|
||||
unsigned long cacRingBufferWrite(
|
||||
struct ca_buffer *pRing,
|
||||
void *pBuf,
|
||||
unsigned long nBytes);
|
||||
|
||||
unsigned long cacRingBufferRead(
|
||||
struct ca_buffer *pRing,
|
||||
void *pBuf,
|
||||
unsigned long nBytes);
|
||||
|
||||
unsigned long cacRingBufferWriteSize(struct ca_buffer *pBuf, int contiguous);
|
||||
unsigned long cacRingBufferReadSize(struct ca_buffer *pBuf, int contiguous);
|
||||
|
||||
char *localUserName();
|
||||
char *localLocationName();
|
||||
|
||||
#else /*__STDC__*/
|
||||
int ca_defunct();
|
||||
void ca_default_exception_handler();
|
||||
int repeater_installed();
|
||||
void cac_send_msg();
|
||||
void build_msg();
|
||||
@@ -367,17 +475,35 @@ void ca_ready_message();
|
||||
void flow_control();
|
||||
char *host_from_addr();
|
||||
int ca_repeater_task();
|
||||
void close_ioc();
|
||||
void recv_msg_select();
|
||||
void mark_server_available();
|
||||
void issue_claim_channel();
|
||||
void ca_request_event();
|
||||
int ca_request_event();
|
||||
void cac_io_done();
|
||||
int post_msg();
|
||||
int alloc_ioc();
|
||||
int ca_printf();
|
||||
void cac_recv_task();
|
||||
void ca_sg_init();
|
||||
void ca_sg_shutdown();
|
||||
void issue_identify_client();
|
||||
void issue_identify_client_location();
|
||||
void ca_mux_io();
|
||||
int ca_select_io();
|
||||
unsigned long cacRingBufferRead();
|
||||
unsigned long cacRingBufferWrite();
|
||||
unsigned long cacRingBufferWriteSize();
|
||||
unsigned long cacRingBufferReadSize();
|
||||
char *localUserName();
|
||||
char *localLocationName();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
#endif
|
||||
/*
|
||||
* !!KLUDGE!!
|
||||
*
|
||||
* this was extracted from dbAccess.h because we are unable
|
||||
* to include both dbAccess.h and db_access.h at the
|
||||
* same time.
|
||||
*/
|
||||
#define S_db_Blocked (M_dbAccess|39) /*Request is Blocked*/
|
||||
|
||||
#endif /* this must be the last line in this file */
|
||||
|
||||
@@ -11,14 +11,21 @@
|
||||
* SPARC alignment in db_access.h
|
||||
*
|
||||
* .04 071291 joh New command added - claim channel in use block
|
||||
*
|
||||
* .05 011294 joh New command added - write notify
|
||||
*
|
||||
* .06 020194 joh New command added for CA V4.1 - client name
|
||||
*/
|
||||
|
||||
#define __IOCMSG__
|
||||
|
||||
static char *iocmsghSccsId = "@(#)iocmsg.h 1.5\t7/27/92";
|
||||
static char *iocmsghSccsId = "$Id$ CA version 4.1";
|
||||
|
||||
/* TCP/UDP port number (bumped each protocol change) */
|
||||
#define CA_PROTOCOL_VERSION 4
|
||||
#define CA_MINOR_VERSION 1
|
||||
#define CA_UKN_MINOR_VERSION 0 /* unknown minor version */
|
||||
#define CA_V41(MAJOR,MINOR) ( ((MAJOR)==4&&(MINOR)>0) || (MAJOR)>4 )
|
||||
#define CA_PORT_BASE IPPORT_USERRESERVED + 56
|
||||
#define CA_SERVER_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2)
|
||||
#define CA_CLIENT_PORT (CA_PORT_BASE+CA_PROTOCOL_VERSION*2+1)
|
||||
@@ -27,7 +34,6 @@ static char *iocmsghSccsId = "@(#)iocmsg.h 1.5\t7/27/92";
|
||||
#define MAX_TCP (MAX_UDP*16) /* so waveforms fit */
|
||||
#define MAX_MSG_SIZE (MAX_TCP) /* the larger of tcp and udp max */
|
||||
|
||||
|
||||
/* values for m_cmmd */
|
||||
#define IOC_NOOP 0 /* do nothing, but verify TCP */
|
||||
#define IOC_EVENT_ADD 1 /* add an event */
|
||||
@@ -50,6 +56,9 @@ static char *iocmsghSccsId = "@(#)iocmsg.h 1.5\t7/27/92";
|
||||
#define IOC_READ_BUILD 16 /* read accompanying a build */
|
||||
#define REPEATER_CONFIRM 17 /* registration confirmation */
|
||||
#define IOC_CLAIM_CIU 18 /* client claims resource in server */
|
||||
#define IOC_WRITE_NOTIFY 19 /* notify after write chan value */
|
||||
#define IOC_CLIENT_NAME 20 /* CA V4.1 identify client */
|
||||
#define IOC_CLIENT_LOCATION 21 /* CA V4.1 identify client */
|
||||
|
||||
/*
|
||||
* for use with build and search and not_found (if search fails and
|
||||
@@ -59,15 +68,15 @@ static char *iocmsghSccsId = "@(#)iocmsg.h 1.5\t7/27/92";
|
||||
#define DONTREPLY 5
|
||||
|
||||
/* size of object in bytes rounded up to nearest oct word */
|
||||
#define OCT_ROUND(A) (((A)+7)>>3)
|
||||
#define OCT_ROUND(A) ((((unsigned long)A)+7)>>3)
|
||||
#define OCT_SIZEOF(A) (OCT_ROUND(sizeof(A)))
|
||||
|
||||
/* size of object in bytes rounded up to nearest long word */
|
||||
#define QUAD_ROUND(A) (((A)+3)>>2)
|
||||
#define QUAD_ROUND(A) (((unsigned long)A)+3)>>2)
|
||||
#define QUAD_SIZEOF(A) (QUAD_ROUND(sizeof(A)))
|
||||
|
||||
/* size of object in bytes rounded up to nearest short word */
|
||||
#define BI_ROUND(A) (((A)+1)>>1)
|
||||
#define BI_ROUND(A) ((((unsigned long)A)+1)>>1)
|
||||
#define BI_SIZEOF(A) (BI_ROUND(sizeof(A)))
|
||||
|
||||
/*
|
||||
@@ -97,7 +106,6 @@ struct extmsg {
|
||||
* by client processes */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* for monitor (event) message extension
|
||||
*/
|
||||
|
||||
@@ -8,11 +8,11 @@
|
||||
* joh 09-13-90 force MIT sign to zero if exponent is zero
|
||||
* to prevent a reseved operand fault.
|
||||
*
|
||||
* joh 03-16-94 Added double fp
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
static char *net_converthSccsId = "@(#)net_convert.h 1.5\t7/27/92";
|
||||
|
||||
/************************************************************************/
|
||||
/* So byte swapping can be performed in line for efficiency */
|
||||
/* (WINTCP has library routines with the same same functionality */
|
||||
@@ -62,7 +62,7 @@ static char *net_converthSccsId = "@(#)net_convert.h 1.5\t7/27/92";
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/* So float convert can be performed in line for efficiency */
|
||||
/* So float convert can be performed in line */
|
||||
/* (THIS ASSUMES IEEE IS THE NETWORK FLOATING POINT FORMAT) */
|
||||
/************************************************************************/
|
||||
struct ieeeflt{
|
||||
@@ -93,9 +93,9 @@ struct ieeeflt{
|
||||
/* Conversion Ranges */
|
||||
/* -128<exp<126 with mantissa of form 1.mant */
|
||||
# define EXPMAXMIT 126 /* max MIT exponent */
|
||||
# define EXPMINMIT -128 /* min MIT exponent */
|
||||
|
||||
|
||||
/* passed by ref untill beter alternative found */
|
||||
/* passed by ref until beter alternative found */
|
||||
/* (this includes mapping of fringe reals to zero or infinity) */
|
||||
/* (byte swaps included in conversion */
|
||||
|
||||
@@ -106,6 +106,7 @@ struct ieeeflt{
|
||||
if( (short)((struct mitflt *) (MIT))->exp < EXPMINIEEE + MIT_SB){\
|
||||
exp = 0;\
|
||||
mant = 0;\
|
||||
sign = 0;\
|
||||
}\
|
||||
else{\
|
||||
exp = (short)((struct mitflt *) (MIT))->exp-MIT_SB+IEEE_SB;\
|
||||
@@ -156,199 +157,120 @@ struct ieeeflt{
|
||||
# define htonf(HOST,NET) {*(float *)(NET) = *(float *)(HOST);}
|
||||
#endif
|
||||
|
||||
/************************************************************************/
|
||||
/* So double convert can be performed in line */
|
||||
/* (THIS ASSUMES IEEE IS THE NETWORK FLOATING POINT FORMAT) */
|
||||
/************************************************************************/
|
||||
struct ieeedbl{
|
||||
unsigned int mant1 : 20;
|
||||
unsigned int exp : 11;
|
||||
unsigned int sign : 1;
|
||||
unsigned int mant2 : 32;
|
||||
};
|
||||
|
||||
#define IEEE_DBL_SB 1023
|
||||
|
||||
/* Conversion Range */
|
||||
/* -1022<exp<1024 with mantissa of form 1.mant */
|
||||
#define DBLEXPMINIEEE -1022 /* min for norm # IEEE exponent */
|
||||
|
||||
#ifdef VAX
|
||||
#ifdef __STDC__
|
||||
int cvrt_short(
|
||||
short *s, /* source */
|
||||
short *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_char(
|
||||
char *s; /* source */
|
||||
char *d; /* destination */
|
||||
int encode; /* cvrt VAX to IEEE if T */
|
||||
int num; /* number of values */
|
||||
);
|
||||
struct mitdbl{
|
||||
unsigned int mant1 : 7;
|
||||
unsigned int exp : 8;
|
||||
unsigned int sign : 1;
|
||||
unsigned int mant2 : 16;
|
||||
unsigned int mant3 : 16;
|
||||
unsigned int mant4 : 16;
|
||||
};
|
||||
|
||||
int cvrt_long(
|
||||
long *s, /* source */
|
||||
long *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
/* Exponent sign bias */
|
||||
# define MIT_DBL_SB 129
|
||||
|
||||
int cvrt_enum(
|
||||
short *s, /* source */
|
||||
short *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
/* Conversion Ranges */
|
||||
/* -128<exp<126 with mantissa of form 1.mant */
|
||||
# define DBLEXPMAXMIT 126 /* max MIT exponent */
|
||||
# define DBLEXPMINMIT -128 /* min MIT exponent */
|
||||
|
||||
int cvrt_float(
|
||||
float *s, /* source */
|
||||
float *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_double(
|
||||
double *s, /* source */
|
||||
double *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
/* passed by ref until beter alternative found */
|
||||
/* (this includes mapping of fringe reals to zero or infinity) */
|
||||
/* (byte swaps included in conversion */
|
||||
|
||||
int cvrt_string(
|
||||
char *s, /* source */
|
||||
char *d, /* destination */
|
||||
int encode, /* cvrt VAX to IEEE if T */
|
||||
int num /* number of values */
|
||||
);
|
||||
# define htond(MIT,IEEE)\
|
||||
{\
|
||||
long tmp;\
|
||||
if( (short)((struct mitdbl *) (MIT))->exp < DBLEXPMINMIT + MIT_DBL_SB){\
|
||||
((struct ieeedbl *) (IEEE))->mant1 = 0;\
|
||||
((struct ieeedbl *) (IEEE))->mant2 = 0;\
|
||||
((struct ieeedbl *) (IEEE))->exp = 0;\
|
||||
((struct ieeedbl *) (IEEE))->sign = 0;\
|
||||
}\
|
||||
else{\
|
||||
((struct ieeedbl *) (IEEE))->exp = \
|
||||
(short)((struct mitdbl *) (MIT))->exp-MIT_DBL_SB+IEEE_DBL_SB;\
|
||||
((struct ieeedbl *) (IEEE))->mant1 =
|
||||
(((struct mitdbl *) (MIT))->mant1<<13) | \
|
||||
(((struct mitdbl *) (MIT))->mant2>>3)
|
||||
((struct ieeedbl *) (IEEE))->mant2 = \
|
||||
(((struct mitdbl *) (MIT))->mant2<<29) | \
|
||||
(((struct mitdbl *) (MIT))->mant3<<13 | \
|
||||
(((struct mitdbl *) (MIT))->mant4>>3;
|
||||
((struct ieeedbl *) (IEEE))->sign = \
|
||||
((struct mitdbl *) (MIT))->sign;\
|
||||
}\
|
||||
tmp = htonl(*(long*)(IEEE));\
|
||||
*(long *)(IEEE) = htonl(*((long*)(IEEE)+1));\
|
||||
*((long *)(IEEE)+1) = tmp;\
|
||||
}
|
||||
|
||||
int cvrt_sts_string(
|
||||
struct dbr_sts_string *s, /* source */
|
||||
struct dbr_sts_string *d, /* destination */
|
||||
int encode, /* do VAX to IEEE */
|
||||
int num /* number of values */
|
||||
);
|
||||
/*
|
||||
* sign must be forced to zero if the exponent is zero to prevent a reserved
|
||||
* operand fault- joh 9-13-90
|
||||
*/
|
||||
# define ntohd(IEEE,MIT)\
|
||||
{\
|
||||
long tmp;\
|
||||
tmp = htonl(*(long*)(IEEE));\
|
||||
*(long *)(IEEE) = htonl(*((long*)(IEEE)+1));\
|
||||
*((long *)(IEEE)+1) = tmp;\
|
||||
if( (short)((struct ieeedbl *) (IEEE))->exp > DBLEXPMAXMIT + IEEE_DBL_SB){\
|
||||
((struct mitdbl *) (MIT))->sign = ((struct ieeedbl *) (IEEE))->sign; \
|
||||
((struct mitdbl *) (MIT))->exp = DBLEXPMAXMIT + MIT_DBL_SB; \
|
||||
((struct mitdbl *) (MIT))->mant1 = ~0; \
|
||||
((struct mitdbl *) (MIT))->mant2 = ~0; \
|
||||
((struct mitdbl *) (MIT))->mant3 = ~0; \
|
||||
((struct mitdbl *) (MIT))->mant4 = ~0; \
|
||||
}\
|
||||
else if( ((struct ieeedbl *) (IEEE))->exp < DBLEXPMINMIT + IEEE_DBL_SB){\
|
||||
((struct mitdbl *) (MIT))->sign = 0; \
|
||||
((struct mitdbl *) (MIT))->exp = 0; \
|
||||
((struct mitdbl *) (MIT))->mant1 = 0; \
|
||||
((struct mitdbl *) (MIT))->mant2 = 0; \
|
||||
((struct mitdbl *) (MIT))->mant3 = 0; \
|
||||
((struct mitdbl *) (MIT))->mant4 = 0; \
|
||||
}\
|
||||
else{\
|
||||
((struct mitdbl *) (MIT))->sign =
|
||||
((struct ieeedbl *) (IEEE))->sign; \
|
||||
((struct mitdbl *) (MIT))->exp =
|
||||
((struct ieeedbl *) (IEEE))->exp+MIT_DBL_SB-IEEE_DBL_SB; \
|
||||
((struct mitdbl *) (MIT))->mant1 =
|
||||
((struct ieeedbl *) (IEEE))->mant1>>13; \
|
||||
((struct mitdbl *) (MIT))->mant2 =
|
||||
(((struct ieeedbl *) (IEEE))->mant1<<3) |
|
||||
(((struct ieeedbl *) (IEEE))->mant2>>29); \
|
||||
((struct mitdbl *) (MIT))->mant3 =
|
||||
((struct ieeedbl *) (IEEE))->mant2>>13; \
|
||||
((struct mitdbl *) (MIT))->mant4 =
|
||||
((struct ieeedbl *) (IEEE))->mant2<<3; \
|
||||
}\
|
||||
}
|
||||
|
||||
int cvrt_sts_short(
|
||||
struct dbr_sts_int *s, /* source */
|
||||
struct dbr_sts_int *d, /* destination */
|
||||
int encode, /* if true; vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_sts_float(
|
||||
struct dbr_sts_float *s, /* source */
|
||||
struct dbr_sts_float *d, /* destination */
|
||||
int encode, /* it true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_gr_short(
|
||||
struct dbr_gr_int *s, /* source */
|
||||
struct dbr_gr_int *d, /* destination */
|
||||
int encode, /* if true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_gr_float(
|
||||
struct dbr_gr_float *s, /* source */
|
||||
struct dbr_gr_float *d, /* destination */
|
||||
int encode, /* if true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_ctrl_short(
|
||||
struct dbr_ctrl_int *s, /* source */
|
||||
struct dbr_ctrl_int *d, /* destination */
|
||||
int encode, /* if true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_ctrl_float(
|
||||
struct dbr_ctrl_float *s, /* source */
|
||||
struct dbr_ctrl_float *d, /* destination */
|
||||
int encode, /* if true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
int cvrt_ctrl_enum(
|
||||
struct dbr_ctrl_enum *s, /* source */
|
||||
struct dbr_ctrl_enum *d, /* destination */
|
||||
int encode, /* if true, vax to ieee */
|
||||
int num /* number of values */
|
||||
);
|
||||
|
||||
#else
|
||||
int cvrt_string();
|
||||
int cvrt_short();
|
||||
int cvrt_float();
|
||||
int cvrt_enum();
|
||||
int cvrt_char();
|
||||
int cvrt_long();
|
||||
int cvrt_double();
|
||||
|
||||
int cvrt_sts_string();
|
||||
int cvrt_sts_short();
|
||||
int cvrt_sts_float();
|
||||
int cvrt_sts_enum();
|
||||
int cvrt_sts_char();
|
||||
int cvrt_sts_long();
|
||||
int cvrt_sts_double();
|
||||
|
||||
int cvrt_time_string();
|
||||
int cvrt_time_short();
|
||||
int cvrt_time_float();
|
||||
int cvrt_time_enum();
|
||||
int cvrt_time_char();
|
||||
int cvrt_time_long();
|
||||
int cvrt_time_double();
|
||||
|
||||
int cvrt_gr_string();
|
||||
int cvrt_gr_short();
|
||||
int cvrt_gr_float();
|
||||
int cvrt_gr_enum();
|
||||
int cvrt_gr_char();
|
||||
int cvrt_gr_long();
|
||||
int cvrt_gr_double();
|
||||
int cvrt_gr_string();
|
||||
|
||||
int cvrt_ctrl_string();
|
||||
int cvrt_ctrl_short();
|
||||
int cvrt_ctrl_float();
|
||||
int cvrt_ctrl_enum();
|
||||
int cvrt_ctrl_char();
|
||||
int cvrt_ctrl_long();
|
||||
int cvrt_ctrl_double();
|
||||
# define ntohd(NET,HOST) {*(double *)(HOST) = *(double *)(NET);}
|
||||
# define htond(HOST,NET) {*(double *)(NET) = *(double *)(HOST);}
|
||||
#endif
|
||||
|
||||
/* cvrt is (array of) (pointer to) (function returning) int */
|
||||
static
|
||||
int (*cvrt[])()
|
||||
=
|
||||
{
|
||||
cvrt_string,
|
||||
cvrt_short,
|
||||
cvrt_float,
|
||||
cvrt_enum,
|
||||
cvrt_char,
|
||||
cvrt_long,
|
||||
cvrt_double,
|
||||
|
||||
cvrt_sts_string,
|
||||
cvrt_sts_short,
|
||||
cvrt_sts_float,
|
||||
cvrt_sts_enum,
|
||||
cvrt_sts_char,
|
||||
cvrt_sts_long,
|
||||
cvrt_sts_double,
|
||||
|
||||
cvrt_time_string,
|
||||
cvrt_time_short,
|
||||
cvrt_time_float,
|
||||
cvrt_time_enum,
|
||||
cvrt_time_char,
|
||||
cvrt_time_long,
|
||||
cvrt_time_double,
|
||||
|
||||
cvrt_gr_string,
|
||||
cvrt_gr_short,
|
||||
cvrt_gr_float,
|
||||
cvrt_gr_enum,
|
||||
cvrt_gr_char,
|
||||
cvrt_gr_long,
|
||||
cvrt_gr_double,
|
||||
|
||||
cvrt_ctrl_string,
|
||||
cvrt_ctrl_short,
|
||||
cvrt_ctrl_float,
|
||||
cvrt_ctrl_enum,
|
||||
cvrt_ctrl_char,
|
||||
cvrt_ctrl_long,
|
||||
cvrt_ctrl_double
|
||||
};
|
||||
#endif
|
||||
|
||||
@@ -116,16 +116,17 @@ static char *os_depenhSccsId = "@(#)os_depen.h 1.12\t2/19/93";
|
||||
# define LOCKEVENTS
|
||||
# define UNLOCKEVENTS
|
||||
# define EVENTLOCKTEST (post_msg_active!=0)
|
||||
# define RECV_ACTIVE(PIIU) (piiu->active)
|
||||
#else
|
||||
# if defined(vxWorks)
|
||||
# define VXTASKIDNONE 0
|
||||
# define LOCK FASTLOCK(&client_lock);
|
||||
# define UNLOCK FASTUNLOCK(&client_lock);
|
||||
# define LOCKEVENTS {FASTLOCK(&event_lock); event_tid=(int)taskIdCurrent;}
|
||||
# define UNLOCKEVENTS {event_tid=VXTASKIDNONE; FASTUNLOCK(&event_lock);}
|
||||
# define EVENTLOCKTEST (FASTLOCKTEST(&event_lock)&&((int)taskIdCurrent)==event_tid)
|
||||
# define RECV_ACTIVE(PIIU) (ca_static->recv_tid == (int)taskIdCurrent)
|
||||
# define LOCK semTake(client_lock, WAIT_FOREVER);
|
||||
# define UNLOCK semGive(client_lock);
|
||||
# define LOCKEVENTS \
|
||||
{semTake(event_lock, WAIT_FOREVER); event_tid=(int)taskIdCurrent;}
|
||||
# define UNLOCKEVENTS \
|
||||
{event_tid=VXTASKIDNONE; semGive(event_lock);}
|
||||
# define EVENTLOCKTEST \
|
||||
(((int)taskIdCurrent)==event_tid || ca_static->recv_tid == (int)taskIdCurrent)
|
||||
# else
|
||||
# if defined(UNIX)
|
||||
# define LOCK
|
||||
@@ -133,7 +134,6 @@ static char *os_depenhSccsId = "@(#)os_depen.h 1.12\t2/19/93";
|
||||
# define LOCKEVENTS
|
||||
# define UNLOCKEVENTS
|
||||
# define EVENTLOCKTEST (post_msg_active!=0)
|
||||
# define RECV_ACTIVE(PIIU) (piiu->active)
|
||||
# else
|
||||
@@@@ dont compile in this case @@@@
|
||||
# endif
|
||||
@@ -143,8 +143,6 @@ static char *os_depenhSccsId = "@(#)os_depen.h 1.12\t2/19/93";
|
||||
#ifdef vxWorks
|
||||
# define VXTHISTASKID taskIdSelf()
|
||||
# define abort(A) taskSuspend(VXTHISTASKID)
|
||||
# define memcpy(D,S,N) bcopy(S,D,N)
|
||||
# define memset(D,V,N) bfill(D,N,V)
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
@@ -160,13 +160,9 @@ int ca_repeater_task()
|
||||
|
||||
ca_repeater();
|
||||
|
||||
#define DEBUG
|
||||
# ifdef DEBUG
|
||||
ca_printf("CA: Only one CA repeater thread per host\n");
|
||||
# endif
|
||||
#undef DEBUG
|
||||
ca_printf("%s, exiting\n", __FILE__);
|
||||
|
||||
return ERROR;
|
||||
exit(0);
|
||||
}
|
||||
|
||||
|
||||
@@ -202,17 +198,17 @@ LOCAL int ca_repeater()
|
||||
SOL_SOCKET,
|
||||
SO_REUSEADDR,
|
||||
(char *)&true,
|
||||
sizeof true);
|
||||
sizeof(true));
|
||||
if(status<0){
|
||||
ca_printf( "%s: set socket option failed\n",
|
||||
__FILE__);
|
||||
}
|
||||
|
||||
memset((char *)&bd,0,sizeof bd);
|
||||
memset((char *)&bd,0,sizeof(bd));
|
||||
bd.sin_family = AF_INET;
|
||||
bd.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
bd.sin_addr.s_addr = INADDR_ANY;
|
||||
bd.sin_port = htons(CA_CLIENT_PORT);
|
||||
status = bind(sock, (struct sockaddr *)&bd, sizeof bd);
|
||||
status = bind(sock, (struct sockaddr *)&bd, sizeof(bd));
|
||||
if(status<0){
|
||||
if(MYERRNO != EADDRINUSE){
|
||||
ca_printf("CA Repeater: unexpected bind fail %d\n",
|
||||
@@ -288,7 +284,7 @@ LOCAL int ca_repeater()
|
||||
|
||||
if(!pclient){
|
||||
pclient = (struct one_client *)
|
||||
malloc(sizeof *pclient);
|
||||
calloc(1,sizeof *pclient);
|
||||
if(pclient){
|
||||
pclient->from = from;
|
||||
ellAdd( &client_list,
|
||||
@@ -365,7 +361,7 @@ struct one_client *pclient;
|
||||
|
||||
memset((char *)&bd,0,sizeof bd);
|
||||
bd.sin_family = AF_INET;
|
||||
bd.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
bd.sin_addr.s_addr = INADDR_ANY;
|
||||
bd.sin_port = port;
|
||||
status = bind(sock, (struct sockaddr *)&bd, sizeof bd);
|
||||
if(status<0){
|
||||
|
||||
1028
src/ca/service.c
1028
src/ca/service.c
File diff suppressed because it is too large
Load Diff
@@ -36,9 +36,15 @@
|
||||
*/
|
||||
|
||||
#include "assert.h"
|
||||
#include "string.h"
|
||||
#include "db_access.h"
|
||||
#include "iocinf.h"
|
||||
|
||||
#ifdef vxWorks
|
||||
#include <tickLib.h>
|
||||
#include <sysLib.h>
|
||||
#endif
|
||||
|
||||
#define CASG_MAGIC 0xFAB4CAFE
|
||||
|
||||
/*
|
||||
@@ -73,9 +79,9 @@ typedef struct{
|
||||
}CASG;
|
||||
|
||||
#ifdef __STDC__
|
||||
static void io_complete(struct event_handler_args args);
|
||||
LOCAL void io_complete(struct event_handler_args args);
|
||||
#else /*__STDC__*/
|
||||
static void io_complete();
|
||||
LOCAL void io_complete();
|
||||
#endif /*__STDC__*/
|
||||
|
||||
|
||||
@@ -93,8 +99,6 @@ void ca_sg_init()
|
||||
*/
|
||||
ellInit(&ca_static->activeCASG);
|
||||
ellInit(&ca_static->freeCASG);
|
||||
ellInit(&ca_static->activeCASGOP);
|
||||
ellInit(&ca_static->freeCASGOP);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -113,10 +117,10 @@ struct ca_static *ca_temp;
|
||||
/*
|
||||
* free all sync group lists
|
||||
*/
|
||||
ellFree(&ca_static->activeCASG);
|
||||
ellFree(&ca_static->freeCASG);
|
||||
ellInit(&ca_static->activeCASGOP);
|
||||
ellInit(&ca_static->freeCASGOP);
|
||||
ellFree(&ca_temp->activeCASG);
|
||||
ellFree(&ca_temp->freeCASG);
|
||||
ellInit(&ca_temp->activeCASGOP);
|
||||
ellInit(&ca_temp->freeCASGOP);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -285,15 +289,15 @@ float timeout;
|
||||
UNLOCK;
|
||||
return ECA_BADSYNCGRP;
|
||||
}
|
||||
UNLOCK;
|
||||
|
||||
/*
|
||||
* always flush and take care
|
||||
* of connection management
|
||||
* at least once.
|
||||
*/
|
||||
ca_flush_io();
|
||||
manage_conn(TRUE);
|
||||
cac_send_msg();
|
||||
UNLOCK;
|
||||
|
||||
status = ECA_NORMAL;
|
||||
beg_time = time(NULL);
|
||||
@@ -307,11 +311,12 @@ float timeout;
|
||||
|
||||
itimeout.tv_usec = LOCALTICKS;
|
||||
itimeout.tv_sec = 0;
|
||||
LOCK;
|
||||
recv_msg_select(&itimeout);
|
||||
UNLOCK;
|
||||
ca_mux_io(&itimeout, CA_DO_SENDS|CA_DO_RECVS);
|
||||
}
|
||||
#else /*UNIX*/
|
||||
ca_flush_io();
|
||||
#endif /*UNIX*/
|
||||
|
||||
#ifdef vxWorks
|
||||
{
|
||||
semTake(pcasg->sem, LOCALTICKS);
|
||||
@@ -342,18 +347,8 @@ float timeout;
|
||||
status = ECA_TIMEOUT;
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
* flush and take care of conn
|
||||
* management prior to each time
|
||||
* that we pend
|
||||
*/
|
||||
LOCK;
|
||||
manage_conn(TRUE);
|
||||
cac_send_msg();
|
||||
UNLOCK;
|
||||
}
|
||||
UNLOCK;
|
||||
pcasg->opPendCount = 0;
|
||||
pcasg->seqNo++;
|
||||
return status;
|
||||
@@ -460,7 +455,6 @@ void *pvalue;
|
||||
return ECA_ALLOCMEM;
|
||||
}
|
||||
}
|
||||
UNLOCK;
|
||||
|
||||
memset(pcasgop, 0,sizeof(*pcasgop));
|
||||
pcasgop->id = gid;
|
||||
@@ -468,6 +462,7 @@ void *pvalue;
|
||||
pcasgop->magic = CASG_MAGIC;
|
||||
pcasgop->pValue = NULL; /* handler will know its a put */
|
||||
ellAdd(&ca_static->activeCASGOP, &pcasgop->node);
|
||||
UNLOCK;
|
||||
|
||||
status = ca_array_put_callback(
|
||||
type,
|
||||
@@ -523,7 +518,6 @@ void *pvalue;
|
||||
return ECA_ALLOCMEM;
|
||||
}
|
||||
}
|
||||
UNLOCK;
|
||||
|
||||
memset(pcasgop, 0,sizeof(*pcasgop));
|
||||
pcasgop->id = gid;
|
||||
@@ -532,6 +526,8 @@ void *pvalue;
|
||||
pcasgop->pValue = pvalue;
|
||||
ellAdd(&ca_static->activeCASGOP, &pcasgop->node);
|
||||
|
||||
UNLOCK;
|
||||
|
||||
status = ca_array_get_callback(
|
||||
type,
|
||||
count,
|
||||
@@ -546,9 +542,9 @@ void *pvalue;
|
||||
* io_complete()
|
||||
*/
|
||||
#ifdef __STDC__
|
||||
static void io_complete(struct event_handler_args args)
|
||||
LOCAL void io_complete(struct event_handler_args args)
|
||||
#else /*__STDC__*/
|
||||
static void io_complete(args)
|
||||
LOCAL void io_complete(args)
|
||||
struct event_handler_args args;
|
||||
#endif /*__STDC__*/
|
||||
{
|
||||
@@ -579,8 +575,9 @@ struct event_handler_args args;
|
||||
|
||||
if(!(args.status&CA_M_SUCCESS)){
|
||||
ca_printf(
|
||||
"CA Sync Group (id=%d) operation failed because \"%s\"\n",
|
||||
"CA Sync Group (id=%d) operation failed because %d \"%s\"\n",
|
||||
pcasgop->id,
|
||||
args.status,
|
||||
ca_message(args.status));
|
||||
UNLOCK;
|
||||
return;
|
||||
|
||||
@@ -34,6 +34,12 @@ struct event_handler_args args;
|
||||
ca_printf("CAC: User argument\t%x\n", args.usr);
|
||||
ca_printf("CAC: Native channel data type\t%d\n", args.chid->type);
|
||||
ca_printf("CAC: Monitor data type\t%d\n", args.type);
|
||||
ca_printf("CAC: CA Status \"%s\"\n", ca_message(args.status));
|
||||
|
||||
if(!args.dbr || !(CA_M_SUCCESS&args.status)){
|
||||
return;
|
||||
}
|
||||
|
||||
switch(args.type){
|
||||
case DBR_STRING:
|
||||
ca_printf("CAC: Value:\t<%s>\n",args.dbr);
|
||||
|
||||
Reference in New Issue
Block a user