53 itsName =
new char[(int)strlen(name)+1];
102 memcpy(
itsData, data, (
size_t)size);
141 itsName =
new char[(int)strlen(name)+1];
143 itsFormat =
new char[(int)strlen(format)+1];
144 strcpy( itsFormat, format);
149 itsCommandHandler = 0;
183 time_t tt1 = 0, tt2 = 0;
188 int tout, clientId,
ids[2];
201 tt1 =
time((time_t *)0);
213 tt2 =
time((time_t *)0);
214 if((tt2 - tt1) > tout)
253 itsName =
new char[(int)strlen(name)+1];
255 itsNameIn =
new char[(int)strlen(name)+1+10];
256 strcpy( itsNameIn, name);
257 strcat(itsNameIn,(
char *)
"/RpcIn");
258 itsNameOut =
new char[(int)strlen(name)+1+10];
259 strcpy( itsNameOut, name);
260 strcat(itsNameOut,(
char *)
"/RpcOut");
261 itsDataOut =
new char[1];
262 itsDataOutSize = itsSizeOut = 1;
306 itsDataOut =
new char[
size];
307 itsDataOutSize =
size;
309 else if(itsDataOutSize < size)
311 delete[] (
char *)itsDataOut;
312 itsDataOut =
new char[
size];
313 itsDataOutSize =
size;
315 memcpy(itsDataOut, data, (
size_t)size);
342 #define DisDnsIdBlock 100 348 itsNode =
new char[(int)strlen(node)+1];
349 strcpy(itsNode,node);
366 if((itsNServiceIds + 2) > itsServiceIdListSize)
369 memcpy(tmp, itsServiceIdList, (
size_t)itsServiceIdListSize*
sizeof(
int));
370 delete itsServiceIdList;
371 itsServiceIdList = tmp;
374 itsServiceIdList[itsNServiceIds] =
id;
375 itsServiceIdList[itsNServiceIds+1] = 0;
384 list = itsServiceIdList;
412 itsName =
new char[(int)strlen(name)+1];
448 itsClientExit =
this;
471 itsName =
new char[(int)strlen(name)+1];
536 if((name) && (isAuto))
574 clientName =
new char[128];
575 clientName[0] =
'\0';
582 clientName =
new char[128];
583 clientName[0] =
'\0';
604 int id, len = 0, index = 0;
606 static char** list = 0;
626 list =
new char*[len];
655 DimServer::itsClientExit = 0;
659 DimServer::itsClientExit =
handler;
666 DimServer::itsClientExit =
this;
675 DimServer::itsExit = 0;
689 DimServer::itsSrvError = 0;
693 DimServer::itsSrvError =
handler;
716 dimDnsNode =
new char[256];
740 DimServer::itsExit =
this;
746 DimServer::itsSrvError =
this;
782 if(DimServer::itsSrvError != 0)
783 DimServer::itsSrvError->
errorHandler(severity, code, msg);
804 declareIt((
char *)name, (
char *)
"L", 0, 0);
814 declareIt((
char *)name, (
char *)
"F", 0, 0);
824 declareIt((
char *)name, (
char *)
"D", 0, 0);
834 declareIt((
char *)name, (
char *)
"X", 0, 0);
844 declareIt((
char *)name, (
char *)
"S", 0, 0);
852 itsSize = (int)strlen(
string)+1;
854 declareIt((
char *)name, (
char *)
"C", 0, 0);
864 declareIt((
char *)name, (
char *)format, 0, 0);
874 declareIt((
char *)name, (
char *)format, handler, 0);
884 declareIt((
char *)name, (
char *)format, 0, 0);
894 declareIt((
char *)name, (
char *)format, handler, 0);
906 declareIt((
char *)name, (
char *)
"L", 0, dns);
916 declareIt((
char *)name, (
char *)
"F", 0, dns);
926 declareIt((
char *)name, (
char *)
"D", 0, dns);
936 declareIt((
char *)name, (
char *)
"X", 0, dns);
946 declareIt((
char *)name, (
char *)
"S", 0, dns);
954 itsSize = (int)strlen(
string)+1;
956 declareIt((
char *)name, (
char *)
"C", 0, dns);
966 declareIt((
char *)name, (
char *)format, 0, dns);
976 declareIt((
char *)name, (
char *)format, handler, dns);
987 declareIt((
char *)name, (
char *)format, 0, dns);
997 declareIt((
char *)name, (
char *)format, handler, dns);
1088 itsSize = (int)strlen(
string)+1;
1223 itsSize = (int)strlen(
string)+1;
1282 storeIt(&data,
sizeof(
float));
1287 storeIt(&data,
sizeof(
double));
1297 storeIt(&data,
sizeof(
short));
1302 storeIt(data, (
int)strlen(data)+1);
1326 millisecs = tmillisecs;
1327 memcpy(
itsData, data, (
size_t)datasize);
1338 declareIt( (
char *)name, (
char *)format, 0, 0);
1343 declareIt( (
char *)name, (
char *)format, handler, 0);
1348 declareIt( (
char *)name, (
char *)format, 0, dns);
1353 declareIt( (
char *)name, (
char *)format, handler, dns);
1359 declareIt( (
char *)name, (
char *)format, 0, 0);
1364 declareIt( (
char *)name, (
char *)format, handler, 0);
1369 declareIt( (
char *)name, (
char *)format, 0, dns);
1374 declareIt( (
char *)name, (
char *)format, handler, dns);
1387 if ((cmndptr = (
CmndInfo *)itsCmndList.removeHead()))
1391 itsSize = currCmnd->itsDataSize;
1392 secs = currCmnd->secs;
1393 millisecs = currCmnd->millisecs;
1401 if ((
CmndInfo *)itsCmndList.getHead())
1474 int tsecs, tmillisecs;
1476 tsecs = getTimestamp();
1477 tmillisecs = getTimestampMillisecs();
1478 cmndptr =
new CmndInfo(getData(), getSize(), tsecs, tmillisecs);
1479 itsCmndList.add(cmndptr);
1506 declareIt( (
char *)name, (
char *)formatin, (
char *)formatout, 0);
1511 declareIt( (
char *)name, (
char *)formatin, (
char *)formatout, dns);
1519 delete[] itsNameOut;
1538 return *(
int *)itsDataIn;
1543 return *(
float *)itsDataIn;
1548 return *(
double *)itsDataIn;
1558 return *(
short *)itsDataIn;
1563 return (
char *)itsDataIn;
1588 storeIt(&data,
sizeof(
double));
1603 storeIt(data,(
int)strlen(data)+1);
CmndInfo(void *data, int datasize, int tsecs, int tmillisecs)
static char * getClientName()
virtual void serviceHandler()
int getTimestampMillisecs()
#define dis_set_client_exit_handler
virtual void commandHandler()=0
#define dis_remove_service
static void exit_user_routine(int *)
void addClientExitHandler()
#define dis_selective_update_service
static void autoStartOff()
int dis_set_dns_port(int port)
static void user_routine(void *tagp, void **buf, int *size, int *first_time)
dim_long dis_add_dns(char *node_name, int port_number)
static DimClientExitHandler * itsClientExit
void init(const char *node, int port)
static void rpcout_routine(void *tagp, void **buf, int *size, int *first_time)
void setQuality(int quality)
static void autoStartOn()
#define dis_get_timestamp
dis_add_service_dns(dnsid, name1,"I",&NewData, sizeof(NewData),(void *) 0, 0)
static DimExitHandler * itsExit
#define dis_set_timestamp
void setTimestamp(int secs, int millisecs)
void dis_add_error_handler(void(*user_routine)())
static void setWriteTimeout(int secs)
char * dis_get_client_services(int conn_id)
static void rpcin_routine(void *tagp, void *buf, int *size)
int getTimeout(int clientId)
int getToken(char *&token)
DimServerDns(const char *node)
void storeIt(void *data, int size)
static int getWriteTimeout()
void setData(void *data, int size)
#define dis_start_serving
#define dis_update_service
static void setClientExitHandler(int clientId)
virtual void errorHandler(int severity, int code, char *msg)=0
static void command_routine(void *tagp, void *buf, int *size)
DimCommandHandler * itsCommandHandler
void dim_set_write_timeout(int secs)
unsigned dis_add_cmnd_dns(dim_long dnsid, char *name, char *type, void(*user_routine)(), dim_long tag)
void setData(void *data, int size)
Warning because the service this data corrsponds to might have been last updated longer ago than Local time
static int setDnsNode(const char *node)
void addServiceId(int id)
int selectiveUpdateService(int *cids)
virtual void serviceHandler()=0
void storeIt(void *data, int size)
int dis_get_dns_node(char *node)
void setName(const char *name)
static DimErrorHandler * itsSrvError
virtual void clientExitHandler()=0
static dim_long addDns(const char *node, int port)
virtual void rpcHandler()=0
int dis_set_dns_node(char *node)
void declareIt(char *name, char *format, DimCommandHandler *handler, DimServerDns *dns)
DimServiceHandler * itsServiceHandler
static char * getDnsNode()
static void srv_error_user_routine(int, int, char *)
int dis_get_timeout(unsigned service_id, int client_id)
static void handler(int conn_id, char *packet, int size, int status)
#define dis_add_exit_handler
#define dis_add_client_exit_handler
int dim_get_write_timeout()
static void clearClientExitHandler(int clientId)
void declareIt(char *name, char *format, DimServiceHandler *handler, DimServerDns *dns)
virtual void exitHandler(int code)=0
virtual void commandHandler()
static void client_exit_user_routine(int *)
int dis_get_n_clients(unsigned service_id)
static char ** getClientServices()
void dis_stop_serving_dns(dim_long dnsid)
dis_start_serving_dns(dnsid,"xx_new")
void declareIt(char *name, char *formatin, char *formatout, DimServerDns *dns)
DimCommand(const char *name, char *format)