This is Unofficial EPICS BASE Doxygen Site
rsrv.h File Reference
#include <stddef.h>
#include "shareLib.h"
+ Include dependency graph for rsrv.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define RSRV_OK   0
 
#define RSRV_ERROR   (-1)
 

Functions

epicsShareFunc void rsrv_register_server (void)
 
epicsShareFunc void casr (unsigned level)
 
epicsShareFunc int casClientInitiatingCurrentThread (char *pBuf, size_t bufSize)
 
epicsShareFunc void casStatsFetch (unsigned *pChanCount, unsigned *pConnCount)
 

Macro Definition Documentation

#define RSRV_ERROR   (-1)

Definition at line 24 of file rsrv.h.

#define RSRV_OK   0

Definition at line 23 of file rsrv.h.

Function Documentation

epicsShareFunc int casClientInitiatingCurrentThread ( char *  pBuf,
size_t  bufSize 
)

Definition at line 165 of file camsgtask.c.

166 {
167  struct client * pClient = ( struct client * )
169 
170  if ( ! pClient )
171  return RSRV_ERROR;
172 
173  if ( pBuf && bufSize ) {
174  epicsSnprintf(pBuf, bufSize, "ca:%s@%s",
175  pClient->pUserName, pClient->pHostName);
176  }
177  return RSRV_OK;
178 }
char * pUserName
Definition: server.h:93
LIBCOM_API void *epicsStdCall epicsThreadPrivateGet(epicsThreadPrivateId)
Definition: osdThread.c:973
epicsThreadPrivateId rsrvCurrentClient
Definition: caservertask.c:50
char * pHostName
Definition: server.h:94
Definition: server.h:76
#define RSRV_OK
Definition: rsrv.h:23
#define RSRV_ERROR
Definition: rsrv.h:24
LIBCOM_API int epicsStdCall epicsSnprintf(char *str, size_t size, const char *format,...) EPICS_PRINTF_STYLE(3
epicsShareFunc void casr ( unsigned  level)

Definition at line 897 of file caservertask.c.

898 {
899  size_t bytes_reserved;
900  int n;
901 
902  if ( ! clientQlock ) {
903  return;
904  }
905 
906  printf ("Channel Access Server V%s\n",
908 
910  n = ellCount ( &clientQ );
911  if (n == 0) {
912  printf("No clients connected.\n");
913  }
914  else if (level == 0) {
915  printf("%d client%s connected.\n",
916  n, n == 1 ? "" : "s" );
917  }
918  else {
919  struct client *client = (struct client *) ellFirst ( &clientQ );
920 
921  printf("%d client%s connected:\n",
922  n, n == 1 ? "" : "s" );
923  while (client) {
924  log_one_client(client, level - 1);
925  client = (struct client *) ellNext(&client->node);
926  }
927  }
929 
930  if (level>=1) {
932  while (iface) {
933  char buf[40];
934 
935  ipAddrToDottedIP (&iface->tcpAddr.ia, buf, sizeof(buf));
936  printf("CAS-TCP server on %s with\n", buf);
937 
938  ipAddrToDottedIP (&iface->udpAddr.ia, buf, sizeof(buf));
939 #if defined(_WIN32)
940  printf(" CAS-UDP name server on %s\n", buf);
941  if (level >= 2)
942  log_one_client(iface->client, level - 2);
943 #else
944  if (iface->udpbcast==INVALID_SOCKET) {
945  printf(" CAS-UDP name server on %s\n", buf);
946  if (level >= 2)
947  log_one_client(iface->client, level - 2);
948  }
949  else {
950  printf(" CAS-UDP unicast name server on %s\n", buf);
951  if (level >= 2)
952  log_one_client(iface->client, level - 2);
953  ipAddrToDottedIP (&iface->udpbcastAddr.ia, buf, sizeof(buf));
954  printf(" CAS-UDP broadcast name server on %s\n", buf);
955  if (level >= 2)
956  log_one_client(iface->bclient, level - 2);
957  }
958 #endif
959 
960  iface = (rsrv_iface_config *) ellNext(&iface->node);
961  }
962  }
963 
964  if (level>=1) {
965  osiSockAddrNode * pAddr;
966  char buf[40];
967  int n = ellCount(&casMCastAddrList);
968 
969  if (n) {
970  printf("Monitoring %d multicast address%s:\n",
971  n, n == 1 ? "" : "es");
972  for(pAddr = (osiSockAddrNode*)ellFirst(&casMCastAddrList);
973  pAddr;
974  pAddr = (osiSockAddrNode*)ellNext(&pAddr->node))
975  {
976  ipAddrToDottedIP (&pAddr->addr.ia, buf, sizeof(buf));
977  printf(" %s\n", buf);
978  }
979  }
980 
981  n = ellCount(&beaconAddrList);
982  printf("Sending CAS-beacons to %d address%s:\n",
983  n, n == 1 ? "" : "es");
984  for(pAddr = (osiSockAddrNode*)ellFirst(&beaconAddrList);
985  pAddr;
986  pAddr = (osiSockAddrNode*)ellNext(&pAddr->node))
987  {
988  ipAddrToDottedIP (&pAddr->addr.ia, buf, sizeof(buf));
989  printf(" %s\n", buf);
990  }
991 
992  if (casIgnoreAddrs[0]) { /* 0 indicates end of array */
993  size_t i;
994  printf("Ignoring UDP messages from address%s\n",
995  n == 1 ? "" : "es");
996  for(i=0; casIgnoreAddrs[i]; i++)
997  {
998  struct sockaddr_in addr;
999  memset(&addr, 0, sizeof(addr));
1000  addr.sin_family = AF_INET;
1001  addr.sin_addr.s_addr = casIgnoreAddrs[i];
1002  addr.sin_port = 0;
1003  ipAddrToDottedIP(&addr, buf, sizeof(buf));
1004  printf(" %s\n", buf);
1005  }
1006  }
1007  }
1008 
1009  if (level>=4u) {
1010  bytes_reserved = 0u;
1011  bytes_reserved += sizeof (struct client) *
1013  bytes_reserved += sizeof (struct channel_in_use) *
1015  bytes_reserved += sizeof(struct event_ext) *
1017  bytes_reserved += MAX_TCP *
1020  bytes_reserved += rsrvSizeofLargeBufTCP *
1022  }
1023  bytes_reserved += rsrvSizeOfPutNotify ( 0 ) *
1025  printf( "Free-lists total %u bytes, comprising\n",
1026  (unsigned int) bytes_reserved);
1027  printf( " %u client(s), %u channel(s), %u monitor event(s), %u putNotify(s)\n",
1028  (unsigned int) freeListItemsAvail ( rsrvClientFreeList ),
1029  (unsigned int) freeListItemsAvail ( rsrvChanFreeList ),
1030  (unsigned int) freeListItemsAvail ( rsrvEventFreeList ),
1031  (unsigned int) freeListItemsAvail ( rsrvPutNotifyFreeList ));
1032  printf( " %u small (%u byte) buffers, %u jumbo (%u byte) buffers\n",
1033  (unsigned int) freeListItemsAvail ( rsrvSmallBufFreeListTCP ),
1034  MAX_TCP,
1037  printf( "Server resource id table:\n");
1038  LOCK_CLIENTQ;
1041  }
1042 }
SOCKET udpbcast
Definition: server.h:163
#define MAX_TCP
Definition: caProto.h:63
#define INVALID_SOCKET
Definition: osdSock.h:32
#define ellCount(PLIST)
Report the number of nodes in a list.
Definition: ellLib.h:84
osiSockAddr addr
Definition: osiSock.h:163
int i
Definition: scan.c:967
GLBLTYPE ELLLIST casMCastAddrList
Definition: server.h:196
LIBCOM_API int epicsStdCall bucketShow(BUCKET *pb)
Display information about a hash table.
Definition: bucketLib.c:476
struct sockaddr_in ia
Definition: osiSock.h:157
osiSockAddr tcpAddr
Definition: server.h:160
osiSockAddr udpbcastAddr
Definition: server.h:160
ELLNODE node
Definition: server.h:159
GLBLTYPE void * rsrvSmallBufFreeListTCP
Definition: server.h:203
#define printf
Definition: epicsStdio.h:41
GLBLTYPE epicsMutexId clientQlock
Definition: server.h:198
struct client * client
Definition: server.h:164
#define LOCK_CLIENTQ
Definition: server.h:223
osiSockAddr udpAddr
Definition: server.h:160
#define CA_VERSION_STRING(MINOR_REVISION)
Definition: caProto.h:27
#define CA_MINOR_PROTOCOL_REVISION
Definition: nciu.h:35
GLBLTYPE ELLLIST beaconAddrList
Definition: server.h:194
#define ellNext(PNODE)
Find the next node in list.
Definition: ellLib.h:99
GLBLTYPE void * rsrvClientFreeList
Definition: server.h:200
Definition: server.h:76
GLBLTYPE void * rsrvLargeBufFreeListTCP
Definition: server.h:204
LIBCOM_API size_t epicsStdCall freeListItemsAvail(void *pvt)
Definition: freeListLib.c:171
GLBLTYPE BUCKET * pCaBucket
Definition: server.h:199
GLBLTYPE void * rsrvChanFreeList
Definition: server.h:201
GLBLTYPE unsigned rsrvSizeofLargeBufTCP
Definition: server.h:205
GLBLTYPE void * rsrvEventFreeList
Definition: server.h:202
ELLNODE node
Definition: osiSock.h:162
GLBLTYPE epicsUInt32 * casIgnoreAddrs
Definition: server.h:197
ELLNODE node
Definition: server.h:77
#define UNLOCK_CLIENTQ
Definition: server.h:224
GLBLTYPE ELLLIST servers
Definition: server.h:193
unsigned rsrvSizeOfPutNotify(struct rsrv_put_notify *pNotify)
Definition: camessage.c:1604
GLBLTYPE void * rsrvPutNotifyFreeList
Definition: server.h:206
unsigned epicsStdCall ipAddrToDottedIP(const struct sockaddr_in *paddr, char *pBuf, unsigned bufSize)
Definition: osiSock.c:144
struct client * bclient
Definition: server.h:164
#define ellFirst(PLIST)
Find the first node in list.
Definition: ellLib.h:89
epicsShareFunc void casStatsFetch ( unsigned *  pChanCount,
unsigned *  pConnCount 
)

Definition at line 1527 of file caservertask.c.

1528 {
1529  LOCK_CLIENTQ;
1530  {
1531  int circuitCount = ellCount ( &clientQ );
1532  if ( circuitCount < 0 ) {
1533  *pCircuitCount = 0;
1534  }
1535  else {
1536  *pCircuitCount = (unsigned) circuitCount;
1537  }
1538  *pChanCount = rsrvChannelCount;
1539  }
1541 }
#define ellCount(PLIST)
Report the number of nodes in a list.
Definition: ellLib.h:84
#define LOCK_CLIENTQ
Definition: server.h:223
#define UNLOCK_CLIENTQ
Definition: server.h:224
GLBLTYPE unsigned rsrvChannelCount
Definition: server.h:207
epicsShareFunc void rsrv_register_server ( void  )

Definition at line 1555 of file caservertask.c.

1556 {
1557  dbRegisterServer(&rsrv_server);
1558 }