DataSource for C SDK  8.0.13.562038-b0f3b66e
datasrc.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright CAPLIN Systems Ltd 2000-2007
4  *
5  *
6  * $Author$
7  * $DateTime$
8  * $Change$
9  * $Id$
10  *
11  *
12  */
13 
14 #ifdef __cplusplus
15 extern "C" {
16 #endif
17 
18 
19 #ifndef __DATASRC_H__
20 #define __DATASRC_H__
21 
22 
23 #undef DATASRC_MAJOR_VERSION
24 #undef DATASRC_MINOR_VERSION
25 #undef DATASRC_PATCH_VERSION
26 
27 #define DATASRC_MAJOR_VERSION 8
28 #define DATASRC_MINOR_VERSION 0
29 #define DATASRC_PATCH_VERSION 13
30 
31 
32 #include <stdio.h>
33 #include <stdlib.h>
34 
35 #ifdef WIN32
36 
37 #include <winsock2.h>
38 #include <windows.h>
39 #include <time.h>
40 #include <ws2tcpip.h>
41 #include <direct.h>
42 #include <io.h>
43 #include <mswsock.h>
44 
45 #else /* ! WIN32 */
46 
47 #include <sys/time.h>
48 #include <sys/types.h>
49 #include <unistd.h>
50 #include <netinet/in.h>
51 #include <sys/socket.h>
52 #include <arpa/inet.h>
53 #include <netdb.h>
54 #include <sys/ioctl.h>
55 #include <net/if.h>
56 #include <sys/uio.h>
57 #include <sys/timeb.h>
58 #include <utime.h>
59 
60 #endif /* ! WIN32 */
61 
62 #include <limits.h>
63 #include <sys/stat.h>
64 #include <string.h>
65 #include <fcntl.h>
66 #include <stdarg.h>
67 #include <errno.h>
68 
69 #define EXIT_CODE_NML 0
70 #define EXIT_CODE_CFG 1
71 #define EXIT_CODE_LOG 2
72 #define EXIT_CODE_NET 3
73 #define EXIT_CODE_SYS 4
74 #define EXIT_CODE_LIC 5
75 #define EXIT_CODE_SIG 6
76 #define EXIT_CODE_SVC 7
77 #define EXIT_CODE_SSL 8
78 #define EXIT_CODE_JVM 9
79 
80 /* Reserve codes for binary start-up issues */
81 #define EXIT_CODE_BIN_MISSING 10
82 #define EXIT_CODE_BIN_NOT_EXEC 11
83 #define EXIT_CODE_BIN_EXIT_AFTER_FORK 12
84 #define EXIT_CODE_BIN_BAD_ARCH 126
85 
86 /* Reserve an exit code for Java DataSource blade errors */
87 #define EXIT_CODE_JAVA_DATASOURCE_ERROR 201
88 
89 #define EXIT_CODE_GRACEFUL 202
90 
91 
92 #ifndef WIN32
93 #ifndef DATASRCAPI
94 #define DATASRCAPI
95 #endif
96 #else /* WIN32 */
97 #ifndef DATASRCAPI
98 #ifndef DATASRC_EXPORT
99 #define DATASRCAPI _declspec(dllimport)
100 #else
101 #define DATASRCAPI _declspec(dllexport)
102 #endif
103 #endif
104 #endif /* WIN32 */
105 
106 
107 /* Provide some protection for variadic arguments */
108 #ifdef __GNUC__
109 #define PRINTF(fmt,arg) __attribute__ ((__format__ (__printf__, (fmt), (arg))))
110 #else
111 #define PRINTF(fmt,arg)
112 #endif
113 
114 
120 /* Types */
121 
126 #ifndef WIN32
127 typedef int sock_t;
128 
135 #define INVALID_SOCKET -1
136 
142 #define SOCKET_ERROR -1
143 #else /* WIN32 */
144 
145 typedef SOCKET sock_t;
146 #include <inttypes.h>
147 #endif /* WIN32 */
148 
152 typedef struct _ds_peer_set ds_set_t;
153 
154 typedef uint64_t ds_bitfield_t;
155 
156 typedef struct _ds_data ds_data_t;
157 
158 typedef struct _ds_field ds_field_t;
159 
163 typedef struct _ds_delay ds_delay_t;
164 
165 
169 typedef struct _config_ctx ds_config_ctx_t;
170 
174 typedef struct _ds_log ds_log_t;
175 
190 typedef void (*recv_update_t)(int peer, ds_data_t *pkt);
191 
208 typedef void (*recv_replay_t)(int peer, ds_data_t *pkt, time_t tm);
209 
228 typedef void (*recv_nodata_t)(int peer, char *subject, unsigned short flags);
229 
252 typedef void (*recv_peer_status_t)(int peer, int status, int val, void *data);
253 
272 typedef void (*recv_request_t)(int peer, int count, char **subjects, unsigned short flags);
273 
292 typedef void (*recv_discard_t)(int peer, int count, char **subjects, unsigned short flags);
293 
313 typedef void (*recv_object_status_t)(int peer, char *subject, int status, unsigned short code, char *msgstr, ds_data_t *metadata);
314 
315 
325 typedef void (*recv_service_status_t)(char *service, int status);
326 
327 
337 typedef void (*recv_map_t)(int peer, char *from, char *to);
338 
339 
357 typedef struct
358  {
361  char *log_root;
362  unsigned short flags;
363  unsigned short type;
379  void (*exit_func)(int exit_code, char *msg);
381  char *logfile;
383  }
384 ds_init_t;
385 
390 #define DS_INITIALISER \
391  { \
392  NULL, /* application_name */ \
393  NULL, /* application_root */ \
394  NULL, /* log_root */ \
395  0, /* flags */ \
396  0, /* type */ \
397  NULL, /* recv_request */ \
398  NULL, /* recv_discard */ \
399  NULL, /* recv_update */ \
400  NULL, /* recv_nodata */ \
401  NULL, /* recv_peer_status */ \
402  NULL, /* recv_object_status */ \
403  NULL, /* recv_service_status */ \
404  NULL, /* recv_map */ \
405  NULL, /* exit_func */ \
406  NULL, /* logfile */ \
407  NULL, /* log */ \
408  }
409 
410 
411 /* datasrc */
412 
413 DATASRCAPI void ds_reserve_std_fds(void);
414 DATASRCAPI void ds_config_init(const char *file, int argc, char **argv);
415 DATASRCAPI int ds_init(ds_init_t *init, int argc, char **argv);
416 DATASRCAPI void ds_thread_init(int event_module, int flags);
417 DATASRCAPI char *ds_filename_expand(const char *format, char *buffer, size_t bufsize);
418 DATASRCAPI ds_log_t *ds_get_event_log(void);
419 
420 
421 /* ds5 */
422 
423 
428 
433  {
439  void (*free)(ds5_namespace_t *nspace);
440 
449  int (*match)(ds5_namespace_t *nspace, const char *subject);
450 
451 
460  char *(*describe)(ds5_namespace_t *nspace, char *buf, size_t buflen);
461 
462  };
463 
464 
465 DATASRCAPI ds5_namespace_t *ds5_create_prefix_namespace(const char *prefix);
466 
467 DATASRCAPI ds5_namespace_t *ds5_create_globbed_namespace(const char *globbed);
468 DATASRCAPI ds5_namespace_t *ds5_create_regex_namespace(const char *expr);
469 DATASRCAPI int ds5_regex_namespace_add_expr(ds5_namespace_t *nspace, const char *expr, int exclude);
470 
471 
472 /* Macros for convenience */
473 
481 #define ds5_namespace_match(nspace, subject) nspace->match(nspace, subject)
482 
487 #define ds5_namespace_free(nspace) nspace->free(nspace)
488 
489 
490 
491 
492 
501 typedef struct _ds5_publisher_s ds5_publisher_t;
502 
503 
504 
505 
506 
507 
508 
519 typedef struct
520  {
539  void (*receive_request)(void *context, int peer, const char *subject);
540 
561  void (*receive_discard)(void *context, int peer, const char *subject);
562  }
564 
565 
566 DATASRCAPI ds5_publisher_t *ds5_create_active_publisher(ds5_namespace_t *nspace, ds5_dataprovider_t *provider, void *context);
567 DATASRCAPI ds5_publisher_t *ds5_create_compatibility_publisher(ds5_namespace_t *nspace, ds5_dataprovider_t *provider, void *context);
569 
571 DATASRCAPI void ds5_publish_to_subscribed_peers(ds5_publisher_t *pub, ds_data_t *dsdata);
572 DATASRCAPI void ds5_publish_response(ds5_publisher_t *pub, ds_data_t *dsdata);
573 DATASRCAPI void ds5_publish_response_no_free(ds5_publisher_t *pub, ds_data_t *dsdata);
574 DATASRCAPI void ds5_publish_status(ds5_publisher_t *pub, const char *subject, int status, const char *message);
575 DATASRCAPI void ds5_publish_status_all(ds5_publisher_t *pub, int status, const char *message);
576 DATASRCAPI void ds5_publish_subject_error(ds5_publisher_t *publisher, const char *subject, int flags);
577 DATASRCAPI void ds5_publish_to_peer(ds5_publisher_t *publisher, int peernum, ds_data_t *dsdata);
578 DATASRCAPI void ds5_publish_to_peer_no_free(ds5_publisher_t *publisher, int peernum, ds_data_t *dsdata);
579 DATASRCAPI void ds5_publish_subject_map(ds5_publisher_t *publisher, const char *subject, const char *mapped_to, int flags);
580 
581 
595 typedef struct
596  {
607  void (*service_status)(void *context, const char *service_name, int state);
608 
620  void (*peer_status)(void *context, int peer_index, const char *peer_name, int state);
621  }
623 
624 
634 typedef struct _ds5_subscription_s ds5_subscription_t;
635 
636 
649 typedef struct
650  {
660  void (*record_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
661 
671  void (*record_type2_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
672 
682  void (*record_type3_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
683 
693  void (*container_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
694 
704  void (*listob_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
705 
715  void (*permission_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
716 
726  void (*news_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
727 
737  void (*news_story_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
738 
748  void (*page_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
749 
762  void (*unknown_subject_type_updated)(void *context, ds5_subscription_t *sub, int peer, ds_data_t *dsdata);
763 
764 
775  void (*subscription_error)(void *context, ds5_subscription_t *sub, int peer, const char *subject, short flags);
776 
788  void (*subscription_status)(void *context, ds5_subscription_t *sub, int peer, const char *subject, int status, const char *message);
789  }
791 
792 
793 
794 
795 
796 DATASRCAPI void ds5_config_init(const char *configfile, int argc, char **argv);
797 DATASRCAPI int ds5_init(int argc, char **argv);
798 DATASRCAPI void ds5_add_connectionlistener(ds5_connectionlistener_t *connection_listener, void *context);
799 
800 
801 
802 
804 DATASRCAPI ds5_subscription_t *ds5_create_active_subscription(const char *subject, ds5_subscriptionlistener_t *listener, void *context);
805 DATASRCAPI void ds5_unsubscribe(ds5_subscription_t *sub);
806 
807 
808 
809 /* config */
810 
811 
820 #define DS_OFFSET(t,m) ((void *)&((t *)0)->m)
821 
825 #define DS_CONFIG_BOOL 0x0001
826 
831 #define DS_CONFIG_INT 0x0002
832 
836 #define DS_CONFIG_FLOAT 0x0003
837 
841 #define DS_CONFIG_STR 0x0004
842 
846 #define DS_CONFIG_CHAR 0x0005
847 
851 #define DS_CONFIG_FUNC 0x0006
852 
856 #define DS_CONFIG_FILE 0x0007
857 
861 #define DS_CONFIG_LONG 0x0008
862 
865 #define DS_CONFIG_GROUP 0x0010
866 #define DS_CONFIG_GROUP_END 0x0011
867 #define DS_CONFIG_SECTION 0x0020
868 #define DS_CONFIG_SECTION_END 0x0021
869 
873 #define DS_CONFIG_JAVA 0x0080
874 
878 #define DS_CONFIG_ARRAY 0x0100
879 
884 #define DS_CONFIG_INT_ARRAY (DS_CONFIG_ARRAY|DS_CONFIG_INT)
885 
889 #define DS_CONFIG_FLOAT_ARRAY (DS_CONFIG_ARRAY|DS_CONFIG_FLOAT)
890 
891 
895 #define DS_CONFIG_STR_ARRAY (DS_CONFIG_ARRAY|DS_CONFIG_STR)
896 
900 #define DS_CONFIG_CHAR_ARRAY (DS_CONFIG_ARRAY|DS_CONFIG_CHAR)
901 
905 #define DS_CONFIG_STRICT 0x0200
906 
911 #define DS_CONFIG_DEPRECATED 0x0400
912 
913 
935 typedef struct
936  {
937  const char *name;
938  double value;
939  const char *docstring;
940  }
942 
943 
956 typedef void (*ds_config_func)(char *name, int num, char **values);
957 
958 
959 DATASRCAPI ds_config_ctx_t *ds_config_new_ctx(void);
960 DATASRCAPI void ds_config_free_ctx(ds_config_ctx_t *ctx);
962 DATASRCAPI void ds_config_add_search(const char *path);
963 DATASRCAPI void ds_config_add_file(const char *file);
964 DATASRCAPI void ds_config_add_optional_file(const char *file);
965 DATASRCAPI void ds_config_add_option(char opt, const char *longopt, const char *help, int type, void *value);
966 DATASRCAPI void ds_config_add_bounded_option(char sopt,const char *longopt, const char *help, int type, void *value, void *min, void *max);
967 DATASRCAPI void ds_config_add_option_enum(char opt,const char *longopt, const char *help, int type, void *value, ds_config_enum_t *enums);
968 DATASRCAPI void ds_config_add_bounded_option_enum(char sopt,const char *longopt, const char *help, int type, void *value, ds_config_enum_t *enums, void *min, void *max);
969 DATASRCAPI void ds_config_add_array_option(const char *longopt, const char *help, int type, void *value, int *num);
970 DATASRCAPI void ds_config_add_bounded_array_option(const char *longopt,const char *help, int type, void *value, int *num, void *min, void *max);
971 DATASRCAPI void ds_config_add_array_option_enum(const char *longopt,const char *help, int type, void *value, int *num, ds_config_enum_t *enums);
972 DATASRCAPI void ds_config_add_bounded_array_option_enum(const char *longopt,const char *help, int type, void *value, int *num, ds_config_enum_t *enums, void *min, void *max);
973 DATASRCAPI void ds_config_del_option(const char *longopt);
974 DATASRCAPI void ds_config_add_group(const char *longopt, const char *help, void *base, void *def, size_t size, int *num);
975 DATASRCAPI void ds_config_add_group_with_info(const char *longopt, const char *help, void *base, void *def, size_t size, int *num, int file_offset, int line_offset);
976 DATASRCAPI void ds_config_end_group(const char *longopt,const char *help);
977 DATASRCAPI void ds_config_add_section(const char *longopt,const char *help);
978 DATASRCAPI void ds_config_end_section(const char *longopt,const char *help);
979 DATASRCAPI void ds_config_parse_files(void);
980 DATASRCAPI void ds_config_parse_args(int argc, char **argv, int *retargc);
981 DATASRCAPI int ds_config_parse_file(const char *unresolved_filename);
982 DATASRCAPI void ds_config_list_options(void);
983 DATASRCAPI void ds_config_list_values(void);
984 DATASRCAPI int ds_config_get_enum(const char *value, ds_config_enum_t *enums);
985 DATASRCAPI void ds_config_add_error_message_fmt(const char *fmt,...) PRINTF(1,2);
986 DATASRCAPI void ds_config_add_config_reading_message_fmt(const char *fmt,...) PRINTF(1,2);
987 DATASRCAPI void ds_config_add_error_message(const char *msg);
988 DATASRCAPI char *ds_config_get_filename(void);
989 DATASRCAPI int ds_config_get_linenumber(void);
990 DATASRCAPI void ds_config_set_test(const char *tag, char **value);
991 DATASRCAPI void ds_config_del_test(const char *tag);
992 DATASRCAPI void ds_config_set_option(const char *name, const char *value);
993 
994 
995 /* event */
996 
997 
998 typedef unsigned long ds_reltime_t;
999 
1004 typedef struct _ds_timed_event ds_timed_event_t;
1005 
1006 
1011 typedef struct _ds_io_event ds_except_event_t;
1012 
1013 
1014 
1019 typedef struct _ds_io_event ds_read_event_t;
1020 
1021 
1026 typedef struct _ds_io_event ds_write_event_t;
1027 
1028 
1033 typedef struct _ds_io_event ds_generic_event_t;
1034 
1035 
1046 typedef int (*ds_io_event_cb)(sock_t sock, int val, void *data);
1047 
1058 typedef int (*ds_timed_event_cb)(int id, int val, void *data);
1059 
1060 
1061 #define DOUBLE_TO_RELTIME(r,d) r = ((int)(d) << 9) + ((int)(((d) - (int)(d)) * 1000000) >> 11);
1062 #define TIMEVAL_TO_RELTIME(r,tv) r = ((tv).tv_sec << 9) + ((tv).tv_usec >> 11);
1063 
1064 
1065 DATASRCAPI ds_timed_event_t *ds_add_timed_event(int id, double delay, ds_timed_event_cb cb, int val, void *data);
1066 DATASRCAPI ds_read_event_t *ds_add_read_event(sock_t fd, ds_io_event_cb cb, int val, void *data);
1067 DATASRCAPI ds_write_event_t *ds_add_write_event(sock_t fd, ds_io_event_cb cb, int val, void *data);
1068 DATASRCAPI ds_except_event_t *ds_add_except_event(sock_t fd, ds_io_event_cb cb, int val, void *data);
1069 
1070 DATASRCAPI int ds_del_timed_event(ds_timed_event_t *ev);
1071 DATASRCAPI int ds_del_read_event(ds_read_event_t *ev);
1072 DATASRCAPI int ds_del_write_event(ds_write_event_t *ev);
1073 DATASRCAPI int ds_del_except_event(ds_except_event_t *ev);
1074 
1075 DATASRCAPI int ds_del_timed_event_free_data(ds_timed_event_t *ev, void (*free_data)(int, void *));
1076 DATASRCAPI int ds_del_read_event_free_data(ds_read_event_t *ev, void (*free_data)(int, void *));
1077 DATASRCAPI int ds_del_write_event_free_data(ds_write_event_t *ev, void (*free_data)(int, void *));
1078 DATASRCAPI int ds_del_except_event_free_data(ds_except_event_t *ev, void (*free_data)(int, void *));
1079 
1080 DATASRCAPI void ds_timed_event_set_callback(ds_timed_event_t *ev, ds_timed_event_cb cb, int val, void *data);
1081 DATASRCAPI double ds_timed_event_get_fire_time(ds_timed_event_t *ev);
1082 DATASRCAPI void ds_read_event_set_callback(ds_read_event_t *ev, ds_io_event_cb cb, int val, void *data);
1083 DATASRCAPI void ds_write_event_set_callback(ds_write_event_t *ev, ds_io_event_cb cb, int val, void *data);
1084 
1085 DATASRCAPI void ds_set_timed_delay(ds_timed_event_t *ev, double delay);
1086 DATASRCAPI void ds_set_timed_delay_next(ds_timed_event_t *ev, double delay);
1087 
1088 DATASRCAPI void ds_loop(void);
1089 DATASRCAPI void ds_stop(void);
1090 
1091 DATASRCAPI ds_reltime_t ds_get_relative_time(void);
1092 DATASRCAPI time_t ds_get_time(void);
1093 DATASRCAPI struct tm *ds_gmtime(void);
1094 DATASRCAPI struct tm *ds_localtime(void);
1095 DATASRCAPI int ds_get_gmt_offset(time_t t);
1096 DATASRCAPI char *ds_get_timezone(char *buf, int len);
1097 
1098 DATASRCAPI ds_timed_event_t *ds_add_periodic_event(int starttime, int period, int id, ds_timed_event_cb cb, int val, void *data);
1099 DATASRCAPI ds_timed_event_t *ds_add_periodic_event_from_time(time_t then, int starttime, int period, int id, ds_timed_event_cb cb, int val, void *data);
1100 DATASRCAPI int ds_check_periodic_event(int period, ds_timed_event_t **tev);
1101 
1102 
1103 /* cache */
1104 
1109 #define DS_CACHE_DATASRC -1
1110 
1111 DATASRCAPI void ds_cache_add_object(char *subject);
1112 
1113 
1114 /* daemon */
1115 
1116 
1117 DATASRCAPI void ds_daemon_redirect(void);
1118 DATASRCAPI int ds_daemon_disabled(void);
1119 
1120 
1121 /* fields */
1122 
1123 
1131 #define DS_FIELDS_SEPARATOR -65536
1132 
1138 #define DS_FIELDS_NOT_DEFINED (-2147483647 - 1)
1139 
1140 DATASRCAPI int ds_fields_max(void);
1141 DATASRCAPI int ds_fields_add(int num, const char *name, int flags, int dp, const char *fmt);
1142 DATASRCAPI int ds_fields_numbyname(const char *name);
1143 DATASRCAPI char *ds_fields_namebynum(int num);
1144 DATASRCAPI int ds_fields_indexbyname(const char *name);
1145 DATASRCAPI int ds_fields_indexbynum(int num);
1146 DATASRCAPI int ds_fields_numbyindex(int index);
1147 DATASRCAPI char *ds_fields_namebyindex(int index);
1148 DATASRCAPI char *ds_fields_rttpnumbyindex(int index);
1149 DATASRCAPI int ds_fields_getflags(int index);
1150 DATASRCAPI int ds_fields_getdp(int index);
1151 
1152 
1153 
1154 /* log */
1155 
1159 #define DS_LOG_CONFIG 0
1160 #define DS_LOG_ALWAYS 1
1161 
1164 #define DS_LOG_CRIT 2
1165 
1168 #define DS_LOG_ERROR 3
1169 
1172 #define DS_LOG_NOTIFY 4
1173 
1176 #define DS_LOG_WARN 5
1177 
1180 #define DS_LOG_INFO 6
1181 
1184 #define DS_LOG_DEBUG 7
1185 
1188 #define DS_LOG_FINER 8
1189 
1192 #define DS_LOG_FINEST 9
1193 
1196 #define DS_LOG_MONITOR 128
1197 
1200 #define DS_LOG_TERMINAL 256
1201 
1204 #define DS_LOG_SYSLOG 512
1205 #define DS_LOG_FILEONLY 1024
1206 #define DS_LOG_NO_MONITOR 2048
1207 
1215 typedef void (*ds_loglevelchange_t)(ds_log_t *log, int new_level);
1216 
1223 typedef void (*ds_logcycled_t)(ds_log_t *log);
1224 
1225 
1226 
1227 
1228 DATASRCAPI ds_log_t *ds_new_log(const char *name,const char *logname);
1229 DATASRCAPI ds_log_t *ds_new_level_log(const char *name, const char *logname, ds_loglevelchange_t change_cb);
1230 DATASRCAPI ds_log_t *ds_new_headed_log(const char *name, const char *logname, const char *header);
1231 DATASRCAPI void ds_free_log(ds_log_t *log);
1232 DATASRCAPI void ds_write(ds_log_t *log, void *data, size_t len);
1233 #ifndef WIN32
1234 DATASRCAPI void ds_writev(ds_log_t *log, struct iovec *vector, int count);
1235 #endif
1236 DATASRCAPI void ds_printf(ds_log_t *log, const char *fmt, ...) PRINTF(2,3);
1237 DATASRCAPI void ds_printf_time(ds_log_t *log, const char *fmt, ...) PRINTF(2,3);
1238 DATASRCAPI void ds_printf_time_ap(ds_log_t *log, const char *extra, const char *fmt, va_list ap);
1239 DATASRCAPI void ds_syslog(ds_log_t *log, int priority, const char *fmt, ...) PRINTF(3,4);
1240 DATASRCAPI void ds_cycle_all_logs(const char *suffix, long maxsize);
1241 DATASRCAPI int ds_cycle_log(ds_log_t *log, const char *suffix, long maxsize);
1242 DATASRCAPI int ds_debug_level(const char *text);
1243 DATASRCAPI char *ds_debug_string(int level);
1244 DATASRCAPI char *ds_debug_config_string(int level);
1245 DATASRCAPI void ds_log(ds_log_t *log, int level, const char *fmt,...) PRINTF(3,4);
1246 DATASRCAPI int ds_log_set_log_level(ds_log_t *log, const char *level);
1247 DATASRCAPI void ds_log_change_level_callback(ds_log_t *log, ds_loglevelchange_t change_cb);
1249 DATASRCAPI char *ds_log_getfilename(ds_log_t *log);
1250 DATASRCAPI char *ds_log_getname(ds_log_t *log);
1251 DATASRCAPI int ds_log_get_level(ds_log_t *log);
1252 DATASRCAPI int ds_log_flush(ds_log_t *log);
1253 
1254 
1255 /* lty_chain */
1256 
1257 
1267 DATASRCAPI void ds_add_latency_chain(ds_data_t *dsdata, char suffix, struct timespec *tp);
1268 
1280 DATASRCAPI void ds_add_latency_chain2(ds_data_t *dsdata, char suffix, struct timespec tp, char suffix2, struct timespec *tp2);
1281 
1286 DATASRCAPI void ds_add_latency_initial_timestamp(ds_data_t *dsdata);
1287 
1288 /* monitor */
1289 
1290 
1294 #define TYPE_NONE 0
1295 
1299 #define TYPE_BINARY 1
1300 
1303 #define TYPE_STRING 2
1304 
1307 #define TYPE_SHORT 3
1308 
1311 #define TYPE_USHORT 4
1312 
1315 #define TYPE_LONG 5
1316 
1319 #define TYPE_ULONG 6
1320 
1323 #define TYPE_LLONG 7
1324 
1327 #define TYPE_ULLONG 8
1328 
1331 #define TYPE_DOUBLE 9
1332 
1337 #define TYPE_TIMESTAMP 10
1338 
1343 #define TYPE_BOOLEAN 11
1344 
1348 #define TYPE_RELATION 20
1349 
1353 #define TYPE_SUBSCRIPTION 21
1354 
1355 
1359 #define TYPE_PRIMITIVE_MASK 31
1360 
1364 #define TYPE_ARRAY 32
1365 
1368 #define TYPE_ACTIVE 64
1369 
1379 #define TYPE_ACTIVE2 128
1380 
1383 #define TYPE_METHOD 256
1384 
1387 #define TYPE_KEY 512
1388 
1391 #define TYPE_HIERARCHY 1024
1392 
1398 #define TYPE_OPTIONAL 2048
1399 
1400 
1406 typedef struct {
1407  size_t size;
1408  union _ds_mondata_value {
1409  void *b;
1410  char **c;
1411  int16_t *s;
1412  uint16_t *us;
1413  int32_t *l;
1414  uint32_t *ul;
1415  int64_t *ll;
1416  uint64_t *ull;
1417  double *d;
1418  } data;
1419  }
1420 ds_array_t;
1421 
1427 typedef struct
1428  {
1430  int datatype;
1431  union _ds_mondata_value2
1432  {
1433  void *active_ptr; /* Do not set used by monitoring API */
1434  char *c;
1435  int16_t s;
1436  uint16_t us; /* Also used for TYPE_BOOLEAN */
1437  int32_t l;
1438  uint32_t ul; /* Also used for TYPE_TIMESTAMP */
1439  int64_t ll;
1440  uint64_t ull;
1441  double d;
1442  ds_array_t array;
1443  }
1444  data;
1445  }
1446 ds_monitor_t;
1447 
1448 
1452 typedef struct
1453  {
1455  char *name;
1456  char *description;
1457  char *docstring;
1458  }
1460 
1461 
1476 typedef ds_monitor_t *(*ds_monitor_method_cb)(char *templatename, char *key, char *property, int argc, char *argv[]);
1477 
1487 typedef ds_monitor_t *(*ds_monitor_active_cb)(char *templatename, char *key, char *propertyname);
1488 
1489 
1490 
1495 typedef struct
1496  {
1497  char *username;
1498  char *password;
1499  char *ipaddress;
1500  }
1501 ds_monauth_t;
1502 
1512 typedef int (*ds_monitor_authenticator_t)(ds_monauth_t *credentials);
1513 
1514 
1515 
1516 DATASRCAPI char *ds_monitor_module_name(void);
1517 
1518 
1519 DATASRCAPI void ds_monitor_add_server_type(const char *type, const char *root);
1520 DATASRCAPI void ds_monitor_start_template(const char *templatename, const char *description);
1521 DATASRCAPI void ds_monitor_add_template_member(const char *templatename, const char *propertyname, const char *description, int typeflags, ds_arguments_t *args, void *ptr);
1522 DATASRCAPI void ds_monitor_add_template_relation(const char *templatename, const char *propertyname, const char *targettemplate, const char *description, int thisend_multiple, int thatend_multiple);
1523 DATASRCAPI void ds_monitor_add_template_subscription(const char *templatename, const char *propertyname, const char *targettemplate, const char *description, const char *singleton, ds_monitor_active_cb callback_fn);
1524 
1525 
1526 DATASRCAPI void ds_monitor_add_relation(const char *templatename, const char *key, const char *propertyname, const char *targetkey);
1527 DATASRCAPI void ds_monitor_del_relation(const char *templatename, const char *key, const char *propertyname, const char *targetkey);
1528 
1529 DATASRCAPI void ds_monitor_add_subscription(const char *templatename, const char *key, const char *propertyname, const char *value);
1530 DATASRCAPI void ds_monitor_del_subscription(const char *templatename, const char *key, const char *propertyname, const char *value);
1531 
1532 DATASRCAPI void ds_monitor_end_template(const char *templatename);
1533 
1534 DATASRCAPI void ds_monitor_create_group(const char *templatename, const char *key, const char *brief, const char *description);
1535 DATASRCAPI void ds_monitor_delete_group(const char *templatename, const char *key);
1536 
1537 
1538 
1539 DATASRCAPI void ds_monitor_update(const char *templatename, const char *key, ds_monitor_t *mondata);
1540 DATASRCAPI void ds_monitor_update_string(const char *templatename, const char *key, const char *propertyname, const char *value);
1541 DATASRCAPI void ds_monitor_update_ushort(const char *templatename, const char *key, const char *propertyname, uint16_t);
1542 DATASRCAPI void ds_monitor_update_short(const char *templatename, const char *key, const char *propertyname, int16_t value);
1543 DATASRCAPI void ds_monitor_update_ulong(const char *templatename, const char *key, const char *propertyname, uint32_t value);
1544 DATASRCAPI void ds_monitor_update_long(const char *templatename,const char *key, const char *propertyname, int32_t value);
1545 DATASRCAPI void ds_monitor_update_ullong(const char *templatename, const char *key, const char *propertyname, uint64_t value);
1546 DATASRCAPI void ds_monitor_update_llong(const char *templatename, const char *key, const char *propertyname, int64_t value);
1547 DATASRCAPI void ds_monitor_update_double(const char *templatename, const char *key, const char *propertyname, double value);
1548 DATASRCAPI void ds_monitor_update_timestamp(const char *templatename, const char *key, const char *propertyname, int64_t value);
1549 DATASRCAPI void ds_monitor_update_boolean(const char *templatename, const char *key, const char *propertyname, uint8_t value);
1550 
1551 
1552 
1553 DATASRCAPI ds_monitor_t *ds_monitor_new(const char *propertyname, int type, int datasize, const void *datum);
1554 DATASRCAPI ds_monitor_t *ds_monitor_new_array(const char *propertyname, int type);
1555 DATASRCAPI void ds_monitor_add_data(ds_monitor_t *data, const void *datum);
1556 DATASRCAPI void ds_monitor_free(ds_monitor_t *data); /* Needed by plugin */
1557 
1558 DATASRCAPI void ds_monitor_free_data(ds_monitor_t *data);
1559 
1560 
1561 DATASRCAPI ds_monitor_t *ds_monitor_new_string(const char *templatename, const char *key, const char *propertyname, const char *value);
1562 DATASRCAPI ds_monitor_t *ds_monitor_new_ushort(const char *templatename, const char *key, const char *propertyname, uint16_t value);
1563 DATASRCAPI ds_monitor_t *ds_monitor_new_short(const char *templatename, const char *key, const char *propertyname, int16_t value);
1564 DATASRCAPI ds_monitor_t *ds_monitor_new_ulong(const char *templatename, const char *key, const char *propertyname, uint32_t value);
1565 DATASRCAPI ds_monitor_t *ds_monitor_new_long(const char *templatename,const char *key, const char *propertyname, int32_t value);
1566 DATASRCAPI ds_monitor_t *ds_monitor_new_ullong(const char *templatename, const char *key, const char *propertyname, uint64_t value);
1567 DATASRCAPI ds_monitor_t *ds_monitor_new_llong(const char *templatename, const char *key, const char *propertyname, int64_t value);
1568 DATASRCAPI ds_monitor_t *ds_monitor_new_double(const char *templatename, const char *key, const char *propertyname, double value);
1569 DATASRCAPI ds_monitor_t *ds_monitor_new_timestamp(const char *templatename, const char *key, const char *propertyname, int64_t value);
1570 DATASRCAPI ds_monitor_t *ds_monitor_new_boolean(const char *templatename, const char *key, const char *propertyname, uint8_t value);
1571 
1572 
1574 
1575 
1576 /* net */
1577 
1578 
1579 DATASRCAPI sock_t ds_listen_socket(const char *addr, int port, int backlog);
1580 DATASRCAPI sock_t ds_accept_socket(sock_t fd);
1581 DATASRCAPI sock_t ds_multicast_listen_socket(const char *p_interface, const char *addr, int port);
1582 DATASRCAPI sock_t ds_udp_listen_socket(const char *p_interface, int port);
1583 DATASRCAPI sock_t ds_client_socket(const char *serv, unsigned short port);
1584 DATASRCAPI sock_t ds_client_socket_nonblocking(const char *serv, unsigned short port);
1585 DATASRCAPI int ds_udp_send(const char *data, int len, const char *addr, int port);
1586 DATASRCAPI int ds_udp_sendto(const char *data, int len, struct sockaddr_storage *serv_addr);
1587 DATASRCAPI sock_t ds_udp_client_socket(const char *addr, int port, struct sockaddr_storage *serv_addr);
1588 DATASRCAPI int ds_udp_bind_client_socket(sock_t sock, const char *addr, int port);
1589 DATASRCAPI char *ds_interface_address(const char *ifname);
1590 DATASRCAPI void ds_setnonblocking(sock_t fd);
1591 DATASRCAPI char *ds_getnameinfo(const struct sockaddr_storage *addr, char *buf, size_t buflen);
1592 DATASRCAPI int ds_compare_sockaddr(struct sockaddr_storage *sa, struct sockaddr_storage *sb);
1593 DATASRCAPI int ds_pipe(sock_t fds[2]);
1594 DATASRCAPI int ds_check_subnet(const char *s_address, const char *s_network, const char *s_netmask);
1595 DATASRCAPI struct sockaddr_storage *ds_gethostsockaddr(const char *name, struct sockaddr_storage *populate);
1596 DATASRCAPI struct addrinfo *ds_gethostsockaddrs(const char *name);
1597 
1598 
1599 
1600 /* Message Types */
1601 
1609 #define DS_MSG_CONNECT 0x0100
1610 
1618 #define DS_MSG_DISCONNECT 0x0200
1619 #define DS_MSG_STATUS 0x0400
1620 
1625 #define DS_MSG_AFFINITY_REMOVED 0x0800
1626 
1627 
1628 /* Peer Types */
1629 
1630 #define DS_T_USERMASK 0x00ff
1631 
1641 #define DS_T_ACTIVE 0x0001
1642 
1653 #define DS_T_CONTRIB 0x0002
1654 
1655 #define DS_T_MSG 0x0100
1656 
1657 
1658 /* Peer Flags */
1659 
1660 #define DS_F_USERMASK 0x00ff
1661 
1677 #define F_SENDFROMSEQ 0x0001
1678 
1679 #define F_SENDFROMFIELD 0x0002
1680 
1681 
1695 #define F_RECVAUTOREPLAY 0x0004
1696 
1697 
1712 #define F_NOCONNECT 0x0008
1713 
1714 #define F_RECONNECT 0x0100
1715 #define F_FAILOVER 0x0200
1716 
1717 #define F_NOFIELDS 0x0400
1718 
1719 
1720 /* No Data Flags */
1721 
1722 #define F_NODATAMASK 0x000f
1723 
1733 #define F_NOTFOUND 0x0001
1734 
1743 #define F_READDENY 0x0002
1744 
1753 #define F_WRITEDENY 0x0003
1754 
1763 #define F_DELETEOBJECT 0x0004
1764 
1773 #define F_UNAVAILABLE 0x0005
1774 #define F_STATUS 0x0006
1775 
1776 
1777 
1783 #define F_IGNOREREQTIMEOUT 0x0008
1784 
1785 /* Object Types */
1786 
1790 #define DS_PAGE_TYPE 221
1791 
1794 #define DS_RECORD_TYPE 222
1795 
1798 #define DS_RECORD_TYPE2 225
1799 
1802 #define DS_RECORD_TYPE3 226
1803 
1806 #define DS_NEWS_TYPE 223
1807 
1810 #define DS_STORY_TYPE 224
1811 
1814 #define DS_CONTAINER_TYPE 228
1815 
1818 #define DS_PERMISSION_TYPE 230
1819 
1826 #define DS_GENERIC_TYPE 231
1827 
1831 #define DS_JSON_TYPE 232
1832 
1836 #define DS_LIST_TYPE 233
1837 
1841 #define DS_BINARY_TYPE 234
1842 
1843 
1844 
1845 /* Data Flags */
1846 
1850 #define F_CREATEOBJECT 0x0010
1851 
1854 #define F_CREATEPARENT 0x0020
1855 #define F_PERSISTENT 0x0040
1856 #define F_CREATEDATA 0x0080
1857 
1861 #define F_CLEAR_PERM 0x0400
1862 
1873 #define F_FILTER_PERM 0x0800
1874 
1879 #define F_AUTHGLOBAL 0x0100
1880 
1884 #define F_CLEAR_TYPE3 0x0100
1885 
1889 #define F_FILTER_TYPE3 0x0200
1890 
1893 #define F_CLEAR_TYPE2 0x0400
1894 
1908 #define F_FILTER_TYPE2 0x0800
1909 
1915 #ifdef __DARWIN_NULL
1916 #undef F_NOCACHE
1917 #endif
1918 #define F_NOCACHE 0x0400
1919 
1926 #define F_DELETE_HEADLINE 0x0100
1927 
1935 #define F_CHANGE_HEADLINE 0x0200
1936 
1941 #define F_IMAGE 0x1000
1942 
1946 #define F_NONACTIVE 0x2000
1947 
1950 #define F_AUTHUPDATE 0x4000
1951 
1952 
1960 #define F_CONSTITUENT_NOAUTH 0x4000
1961 
1968 #define F_CHANGEDFIELDS 0x8000
1969 
1970 /* Field Data Types */
1971 
1972 #define FLOAT32_TYPE 1
1973 #define FLOAT64_TYPE 2
1974 #define INT8_TYPE 3
1975 #define INT16_TYPE 4
1976 #define INT32_TYPE 5
1977 #define INT64_TYPE 6
1978 #define UINT8_TYPE 7
1979 #define UINT16_TYPE 8
1980 #define UINT32_TYPE 9
1981 #define UINT64_TYPE 10
1982 
1983 
1984 /* Object request flags */
1985 
1995 #define DS_REQUEST_FAILOVER 1
1996 
2005 #define DS_REQUEST_CACHE 4
2006 
2007 
2008 
2009 /* Object Status Flags */
2010 
2020 #define S_INFO 0x0000
2021 
2030 #define S_STALE 0x0001
2031 
2040 #define S_NOTSTALE 0x0004
2041 
2053 #define S_UPDCLR 0x0100
2054 
2065 #define S_FAILOVER 0x1101 /* Failover implies S_STALE|S_UPDCLR */
2066 
2067 
2080 #define OBJ_STATUS_INFO 0x0000
2081 
2094 #define OBJ_STATUS_OK 0x0001
2095 
2110 #define OBJ_STATUS_STALE 0x0002
2111 
2112 
2128 #define OBJ_STATUS_LIMITED 0x0008
2129 
2130 
2131 #define OBJ_STATUS_NOTMAPPED 0x0010
2132 
2141 #define SVC_STATUS_OK 0x0001
2142 
2151 #define SVC_STATUS_DOWN 0x0002
2152 
2161 #define SVC_STATUS_LIMITED 0x0008
2162 
2163 
2164 /* Field Macros */
2165 #define DS_MAX_BITFIELD (sizeof(ds_bitfield_t)*8)
2166 
2167 #define DS_BITFIELD_SET(n,p) *(p) |= (1ULL << (n))
2168 #define DS_BITFIELD_CLR(n,p) *(p) &= ~(1ULL << (n))
2169 #define DS_BITFIELD_ISSET(n,p) (*(p) & (1ULL << (n)))
2170 #define DS_BITFIELD_ZERO(p) *(p) = 0
2171 #define DS_BITFIELD_NONZERO(p) memset((char *)(p), 0xffffffff, sizeof(*(p)))
2172 
2173 /* Peer set functions and macros */
2174 
2175 DATASRCAPI int ds_iszero(ds_set_t *p);
2176 DATASRCAPI void ds_not(ds_set_t *p);
2177 DATASRCAPI void ds_or(ds_set_t *p1, ds_set_t *p2, ds_set_t *o);
2178 DATASRCAPI void ds_and(ds_set_t *p1, ds_set_t *p2, ds_set_t *a);
2179 DATASRCAPI int ds_and_iszero(ds_set_t *p1, ds_set_t *p2);
2180 DATASRCAPI int ds_and3_iszero(ds_set_t *p1, ds_set_t *p2, ds_set_t *p3);
2181 DATASRCAPI int ds_and_equal(ds_set_t *a1, ds_set_t *a2, ds_set_t *eq);
2182 DATASRCAPI int ds_isequal(ds_set_t *p1, ds_set_t *p2);
2183 
2188 #define DS_MAX_PEERS 1024
2189 
2194 #define DS_MIN_PEER 0
2195 
2200 #define DS_INTERNAL_DATASRC 1023
2201 
2202 typedef uint32_t dsset_element_t;
2203 
2204 #define DS_NUMBITS (sizeof(dsset_element_t) * 8)
2205 #define DS_NUM_ELEMS (DS_MAX_PEERS+DS_NUMBITS-1)/DS_NUMBITS
2206 #define DS_NUM_BYTES (DS_NUM_ELEMS * sizeof(dsset_element_t))
2207 
2208 struct _ds_peer_set
2209  {
2210  dsset_element_t bits[DS_NUM_ELEMS];
2211  };
2212 
2217 #define DS_SET(n,p) ((p)->bits[(n)/DS_NUMBITS] |= ((unsigned)1 << ((n) % DS_NUMBITS)))
2218 
2223 #define DS_CLR(n,p) ((p)->bits[(n)/DS_NUMBITS] &= ~((unsigned)1 << ((n) % DS_NUMBITS)))
2224 
2229 #define DS_ISSET(n,p) ((p)->bits[(n)/DS_NUMBITS] & ((unsigned)1 << ((n) % DS_NUMBITS)))
2230 
2235 #define DS_ZERO(p) memset((char *)(p)->bits, 0, DS_NUM_BYTES)
2236 
2241 #define DS_NONZERO(p) memset((char *)(p)->bits, 0xff, DS_NUM_BYTES)
2242 
2247 #define DS_NOT(p) ds_not(p)
2248 
2253 #define DS_ISZERO(p) ds_iszero(p)
2254 
2259 #define DS_AND(p1, p2, a) ds_and(p1, p2, a)
2260 
2265 #define DS_OR(p1, p2, o) ds_or(p1, p2, o)
2266 
2271 #define DS_AND_ISZERO(p1, p2) ds_and_iszero(p1, p2)
2272 
2277 #define DS_AND3_ISZERO(p1, p2, p3) ds_and3_iszero(p1, p2, p3)
2278 
2283 #define DS_AND_EQ(a1,a2,eq) ds_and_equal(a1,a2,eq)
2284 
2285 
2290 #define DS_ISEQUAL(p1, p2) ds_isequal(p1, p2)
2291 
2292 DATASRCAPI ds_data_t *ds_init_data(const char *subject, unsigned short type, unsigned short flags);
2293 DATASRCAPI void ds_set_subject(ds_data_t *data, const char *subject);
2294 
2295 DATASRCAPI void ds_add_data(ds_data_t *data, int32_t fieldnum, const char *value);
2296 DATASRCAPI void ds_add_data_fmt(ds_data_t *data, int32_t fieldnum, const char *fmt, ...);
2297 DATASRCAPI void ds_add_data_str(ds_data_t *data, int32_t fieldnum, const char *value);
2298 DATASRCAPI void ds_add_data_float32(ds_data_t *data, int32_t fieldnum, float value);
2299 DATASRCAPI void ds_add_data_float64(ds_data_t *data, int32_t fieldnum, double value);
2300 DATASRCAPI void ds_add_data_int8(ds_data_t *data, int32_t fieldnum, int8_t value);
2301 DATASRCAPI void ds_add_data_int16(ds_data_t *data, int32_t fieldnum, int16_t value);
2302 DATASRCAPI void ds_add_data_int32(ds_data_t *data, int32_t fieldnum, int32_t value);
2303 DATASRCAPI void ds_add_data_int64(ds_data_t *data, int32_t fieldnum, int64_t value);
2304 DATASRCAPI void ds_add_data_uint8(ds_data_t *data, int32_t fieldnum, uint8_t value);
2305 DATASRCAPI void ds_add_data_uint16(ds_data_t *data, int32_t fieldnum, uint16_t value);
2306 DATASRCAPI void ds_add_data_uint32(ds_data_t *data, int32_t fieldnum, uint32_t value);
2307 DATASRCAPI void ds_add_data_uint64(ds_data_t *data, int32_t fieldnum, uint64_t value);
2308 DATASRCAPI void ds_add_data_char(ds_data_t *data, int32_t fieldnum, char value);
2309 
2310 DATASRCAPI ds_data_t *ds_clone_data(ds_data_t *data);
2311 
2312 #define ds_add_data_short(d,f,v) ds_add_data_int16(d,f,v)
2313 #define ds_add_data_int(d,f,v) ds_add_data_int32(d,f,v)
2314 #define ds_add_data_long(d,f,v) ds_add_data_int32(d,f,v)
2315 #define ds_add_data_float(d,f,v) ds_add_data_float32(d,f,v)
2316 #define ds_add_data_double(d,f,v) ds_add_data_float64(d,f,v)
2317 
2318 DATASRCAPI void ds_send_data(ds_data_t *data);
2319 DATASRCAPI void ds_send_data_to_peer(int peer, ds_data_t *data);
2320 DATASRCAPI void ds_send_data_no_free(ds_data_t *data);
2321 DATASRCAPI void ds_send_data_to_peer_no_free(int peer, ds_data_t *data);
2322 DATASRCAPI void ds_send_nodata(const char *subject, unsigned short flags);
2323 DATASRCAPI void ds_send_nodata_to_peer(int peer, const char *subject, unsigned short flags);
2324 DATASRCAPI void ds_free_data(ds_data_t *data);
2325 DATASRCAPI void ds_send_status(const char *subject, unsigned short flags, unsigned short code, const char *msgstr);
2326 DATASRCAPI void ds_send_status_to_peer(int peer,const char *subject, unsigned short flags, unsigned short code, const char *msgstr);
2327 DATASRCAPI void ds_send_data_direct(ds_data_t *data);
2328 DATASRCAPI void ds_send_nodata_direct(const char *subject, unsigned short flags);
2329 DATASRCAPI void ds_send_status_direct(const char *subject, unsigned short flags, unsigned short code, const char *msgstr);
2330 
2331 DATASRCAPI void ds_send_map_to_peer(int peer, const char *subject, const char *mapped, unsigned short flags);
2332 DATASRCAPI void ds_send_map(const char *subject, const char *mapped, unsigned short flags);
2333 
2334 
2345 typedef void (*ds_delay_send_cb)(void *context, ds_data_t *dsdata);
2346 
2347 DATASRCAPI ds_delay_t *ds_new_delay(double delay_time, char *prefix, double batch_time);
2348 DATASRCAPI ds_delay_t *ds_new_delay_with_callback(double delay_time, char *prefix, double batch_time, void *callback_param, ds_delay_send_cb callback_func);
2349 DATASRCAPI void ds_delay_data(ds_delay_t *delay, ds_data_t *dsdata);
2350 
2351 DATASRCAPI int32_t ds_add_record_str(ds_data_t *data, const char *field, const char *value);
2352 DATASRCAPI int32_t ds_add_record_int(ds_data_t *data,const char *field, int value);
2353 DATASRCAPI int32_t ds_add_record_char(ds_data_t *data,const char *field, char value);
2354 DATASRCAPI int32_t ds_add_record_float(ds_data_t *data,const char *field, double value);
2355 DATASRCAPI int32_t ds_add_record_fmt(ds_data_t *data,const char *field, const char *fmt, ...);
2356 
2357 DATASRCAPI ds_data_t *ds_init_page(const char *subject, int rows, int cols, const char *type, unsigned short flags);
2358 DATASRCAPI void ds_add_page_row(ds_data_t *data, int row, int col, const char *str);
2359 DATASRCAPI void ds_add_page_field(ds_data_t *data, int32_t fieldnum, const char *value);
2360 DATASRCAPI void ds_add_page_field_by_name(ds_data_t *data, const char *field, const char *value);
2361 
2362 DATASRCAPI ds_data_t *ds_init_news(const char *subject, unsigned short flags);
2363 DATASRCAPI void ds_add_news_headline(ds_data_t *data, const char *headline);
2364 DATASRCAPI void ds_add_news_storycode(ds_data_t *data, const char *story);
2365 DATASRCAPI void ds_add_news_datetime(ds_data_t *data, const char *datestr);
2366 DATASRCAPI void ds_add_news_authstr(ds_data_t *data, const char *authstr);
2367 DATASRCAPI void ds_add_news_product_code(ds_data_t *data, const char *code);
2368 DATASRCAPI void ds_add_news_topic_code(ds_data_t *data, const char *code);
2369 DATASRCAPI void ds_add_news_company_code(ds_data_t *data, const char *code);
2370 DATASRCAPI void ds_add_news_user_code(ds_data_t *data, int codenum, const char *code);
2371 DATASRCAPI void ds_add_news_field(ds_data_t *dsdata, const char *fieldname, const char *value);
2372 
2373 DATASRCAPI ds_data_t *ds_init_container(const char *subject, const unsigned short flags);
2374 DATASRCAPI void ds_add_container_symbol_and_request(ds_data_t *data, const char *symbol, const int request);
2375 DATASRCAPI void ds_add_container_symbol(ds_data_t *data, const char *symbol);
2376 DATASRCAPI void ds_add_container_symbol_at_position(ds_data_t *data, int position, const char *symbol);
2377 DATASRCAPI void ds_remove_container_symbol(ds_data_t *data, const char *symbol);
2378 DATASRCAPI void ds_cleardown_container_with_prefix(ds_data_t *data, const char *prefix);
2379 
2380 DATASRCAPI ds_data_t *ds_init_permission(const char *subject, const char *key, unsigned short flags);
2381 DATASRCAPI void ds_add_permission_key(ds_data_t *data, const char *key);
2382 
2383 DATASRCAPI void ds_add_binary(ds_data_t *data, int32_t fieldnum, char *value, int len, char type);
2384 DATASRCAPI void ds_add_binary_float32(ds_data_t *data, int32_t fieldnum, float value);
2385 DATASRCAPI void ds_add_binary_float64(ds_data_t *data, int32_t fieldnum, double value);
2386 DATASRCAPI void ds_add_binary_int8(ds_data_t *data, int32_t fieldnum, int8_t value);
2387 DATASRCAPI void ds_add_binary_int16(ds_data_t *data, int32_t fieldnum, int16_t value);
2388 DATASRCAPI void ds_add_binary_int32(ds_data_t *data, int32_t fieldnum, int32_t value);
2389 DATASRCAPI void ds_add_binary_int64(ds_data_t *data, int32_t fieldnum, int64_t value);
2390 DATASRCAPI void ds_add_binary_uint8(ds_data_t *data, int32_t fieldnum, uint8_t value);
2391 DATASRCAPI void ds_add_binary_uint16(ds_data_t *data, int32_t fieldnum, uint16_t value);
2392 DATASRCAPI void ds_add_binary_uint32(ds_data_t *data, int32_t fieldnum, uint32_t value);
2393 DATASRCAPI void ds_add_binary_uint64(ds_data_t *data, int32_t fieldnum, uint64_t value);
2394 DATASRCAPI void ds_add_binary_string(ds_data_t *data, int32_t fieldnum, char *value);
2395 DATASRCAPI void ds_add_binary_opaque(ds_data_t *data, int32_t fieldnum, char *value, int len);
2396 DATASRCAPI void ds_add_binary_time(ds_data_t *data, int32_t fieldnum, time_t value);
2397 DATASRCAPI void ds_add_binary_time_millis(ds_data_t *data, int32_t fieldnum, int64_t value);
2398 DATASRCAPI void ds_add_binary_timeval(ds_data_t *data, int32_t fieldnum, struct timeval value);
2399 DATASRCAPI void ds_add_binary_timespec(ds_data_t *data, int32_t fieldnum, struct timespec value);
2400 DATASRCAPI void ds_add_binary_blob(ds_data_t *data, int32_t fieldnum, uint8_t *value, size_t len);
2401 DATASRCAPI ds_data_t *ds_init_binaryob(const char *subject, const unsigned short flags);
2402 
2403 #define ds_add_binary_char(d,f,v) ds_add_binary_int8(d,f,v);
2404 #define ds_add_binary_short(d,f,v) ds_add_binary_int16(d,f,v);
2405 #define ds_add_binary_int(d,f,v) ds_add_binary_int32(d,f,v);
2406 #define ds_add_binary_long(d,f,v) ds_add_binary_int32(d,f,v);
2407 #define ds_add_binary_float(d,f,v) ds_add_binary_float32(d,f,v);
2408 #define ds_add_binary_double(d,f,v) ds_add_binary_float64(d,f,v);
2409 #define ds_add_binary_time_micros(d,f,v) ds_add_binary_timeval(d,f,v);
2410 #define ds_add_binary_time_nanos(d,f,v) ds_add_binary_timespec(d,f,v);
2411 
2412 
2416 #define NEWS_HEADLINE_FIELDNUM 0
2417 
2420 #define NEWS_STORYCODE_FIELDNUM 1
2421 
2424 #define NEWS_DATETIME_FIELDNUM 2
2425 
2428 #define NEWS_AUTHSTR_FIELDNUM 5
2429 
2432 #define NEWS_PRODUCT_CODE_FIELDNUM 100
2433 
2436 #define NEWS_TOPIC_CODE_FIELDNUM 101
2437 
2440 #define NEWS_COMPANY_CODE_FIELDNUM 102
2441 
2444 #define NEWS_USER_CODE_FIELDNUM 200
2445 
2448 #define NEWS_USER_CODE_MAX 10
2449 
2450 #define NEWS_SIZE_FIELDNUM 300
2451 #define NEWS_REASON_FIELDNUM 301
2452 
2453 #define NEWS_REQ_SEARCH 1000
2454 #define NEWS_REQ_STORYCODE 1001
2455 #define NEWS_REQ_DATE_TO 1002
2456 #define NEWS_REQ_DATE_FROM 1003
2457 #define NEWS_REQ_FLAGS 1004
2458 
2459 #define NEWS_GENERIC_FIELDNUM 1024
2460 
2461 /* peer */
2462 
2463 
2464 DATASRCAPI extern int ds_num_peers;
2465 
2466 
2467 DATASRCAPI int ds_peer_details(int peer, char **name);
2468 DATASRCAPI int ds_peer_host_details(int peer, char **addr);
2469 DATASRCAPI int ds_peer_id(int peer);
2470 DATASRCAPI char *ds_peer_name(int peer);
2471 DATASRCAPI int ds_peer_flags(int peer);
2472 DATASRCAPI int ds_peer_local_type(int peer);
2473 DATASRCAPI int ds_peer_type(int peer);
2474 DATASRCAPI int ds_peer_up(int peer);
2475 DATASRCAPI void ds_peer_add_extra_handshake_data(int peer, const char *data);
2476 DATASRCAPI int ds_peer_all_type(int flag);
2477 
2478 DATASRCAPI void ds_set_status_down(void);
2479 DATASRCAPI void ds_set_status_down_to_peer(int peer);
2480 DATASRCAPI void ds_set_status_msg(unsigned short msgid, const char *msgstr);
2481 DATASRCAPI void ds_set_status_msg_to_peer(int peer, unsigned short msgid, const char *msgstr);
2482 DATASRCAPI void ds_set_status_up(void);
2483 DATASRCAPI void ds_set_status_up_to_peer(int peer);
2484 DATASRCAPI int ds_peer_by_label(const char *label);
2485 DATASRCAPI int ds_peer_by_local_label(const char *label);
2486 DATASRCAPI char *ds_peer_label_byindex(int index);
2487 DATASRCAPI int ds_peer_enabled_state(int peer);
2488 
2489 DATASRCAPI int ds_peer_details_r(int peer, char *buffer, size_t buflen);
2490 DATASRCAPI int ds_peer_host_details_r(int peer, char *buffer, size_t buflen);
2491 DATASRCAPI char *ds_peer_name_r(int peer, char *buffer, size_t buflen);
2492 DATASRCAPI char *ds_peer_label_byindex_r(int peer, char *buffer, size_t buflen);
2493 
2494 /* pkt */
2495 
2502 struct _ds_data
2503  {
2504  unsigned short seq;
2505  unsigned short flags;
2506  unsigned short type;
2507  char *subject;
2508  unsigned short count;
2510  time_t time;
2511  };
2512 
2520  {
2521  int32_t fieldnum;
2522  int32_t len;
2523  char *value;
2524  unsigned short flags;
2525  };
2526 
2527 
2528 /* replay */
2529 
2530 
2531 DATASRCAPI void ds_replay(recv_replay_t callback);
2532 DATASRCAPI int ds_replay_from_file(recv_replay_t callback, char *filename);
2533 DATASRCAPI void ds_replay_from_log(recv_replay_t callback, ds_log_t *log);
2534 DATASRCAPI void ds_replay_by_time(time_t t, recv_replay_t callback);
2535 DATASRCAPI int ds_replay_by_time_from_file(time_t t, recv_replay_t callback, char *filename);
2536 DATASRCAPI void ds_replay_by_time_from_log(time_t t, recv_replay_t callback, ds_log_t *log);
2537 DATASRCAPI void ds_replay_by_field(int fieldnum, char *value, recv_replay_t callback);
2538 DATASRCAPI int ds_replay_by_field_from_file(int fieldnum, char *value, recv_replay_t callback, char *filename);
2539 DATASRCAPI void ds_replay_by_field_from_log(int fieldnum, char *value, recv_replay_t callback, ds_log_t *log);
2540 
2541 
2542 /* udp */
2543 
2544 
2549 typedef struct _ds_udp_event ds_udp_event_t;
2550 
2562 typedef int (*ds_udp_event_cb)(int argc, char *argv[], int val, void *data);
2563 
2564 
2565 DATASRCAPI ds_udp_event_t *ds_add_udp_event(const char *command, ds_udp_event_cb cb, int val, void *data);
2566 DATASRCAPI void ds_del_udp_event(ds_udp_event_t *event);
2567 
2568 DATASRCAPI void ds_udpsignal_send(const char *message);
2569 DATASRCAPI void ds_udpsignal_send_argv(const char *message, char *argv[]);
2570 
2571 /* Deprecated methods of handling udp commands */
2572 DATASRCAPI int ds_udpsignal_addjob(const char *cmd,void (*fn)(int argc,char *argv[]), const char *description);
2573 DATASRCAPI int ds_udpsignal_deljob(const char *cmd, void (*fn)(int argc, char *argv[]));
2574 
2575 /* misc */
2576 
2577 DATASRCAPI void ds_set_productname(const char *name);
2578 
2579 /* list object */
2580 
2581 DATASRCAPI ds_data_t *ds_init_listob(const char *subject, const unsigned short flags);
2582 DATASRCAPI void ds_add_listob_row(ds_data_t *data, const char *row_id);
2583 DATASRCAPI void ds_add_listob_row_at_position(ds_data_t *data, int position, const char *row_id);
2584 DATASRCAPI void ds_remove_listob_row(ds_data_t *data, const char *row_id, char clear);
2585 DATASRCAPI void ds_add_listob_row_data(ds_data_t *data, const char *row_id, ds_data_t *row_fields);
2586 
2587 /* advmap */
2588 
2589 DATASRCAPI char *ds_request_object(const char *name);
2590 DATASRCAPI char *ds_request_object_with_flags(const char *name,int flags);
2591 DATASRCAPI int ds_request_objects(int count, char **obs, char ***services);
2592 DATASRCAPI int ds_request_objects_with_flags(int count, char **obs, int flags, char ***services);
2593 DATASRCAPI void ds_discard_object(const char *name);
2594 DATASRCAPI void ds_discard_objects(int count, char **obs);
2595 DATASRCAPI char * ds_get_service(const char *name);
2596 DATASRCAPI int ds_send_contribution(ds_data_t *dsdata);
2597 DATASRCAPI int ds_get_num_services(void);
2598 DATASRCAPI int ds_get_service_by_index(int index, char **name_ptr);
2599 DATASRCAPI int ds_object_available(const char *name);
2600 DATASRCAPI int ds_object_can_contrib(const char *name);
2601 DATASRCAPI void ds_purge_object(const char *name);
2602 DATASRCAPI int ds_required_services_status(char *buf, size_t buflen);
2603 DATASRCAPI int ds_get_service_type(const char *servicename);
2604 DATASRCAPI int ds_get_is_contrib_source(const char *name, int peer);
2605 
2607 DATASRCAPI int ds_set_request_hint(const char *name, int num, char **hints);
2608 DATASRCAPI char **ds_get_request_hints(const char *name, int *ret);
2609 DATASRCAPI char **ds_get_request_hints_dynamic(const char *name, int *ret);
2610 DATASRCAPI void ds_set_object_data(const char *name, void *data);
2611 DATASRCAPI void *ds_get_object_data(const char *name);
2612 
2613 /* signature */
2614 DATASRCAPI int ds_signature_check(char *key_id, char *token);
2615 
2616 /* page */
2617 
2618 #define DS_BIGPAGE_R 25
2619 #define DS_BIGPAGE_C 80
2620 #define DS_BIGPAGE_TYPE "25"
2621 #define DS_SMALLPAGE_R 14
2622 #define DS_SMALLPAGE_C 64
2623 #define DS_SMALLPAGE_TYPE "218"
2624 
2625 
2626 DATASRCAPI int ds_signature_verify_username(char *expected_username, char *token);
2627 
2634 #define DS_SIGNATURE_OK 0
2635 
2641 #define DS_SIGNATURE_INVALID_TOKEN 1
2642 
2648 #define DS_SIGNATURE_UNKNOWN_KEYID 2
2649 
2655 #define DS_SIGNATURE_ALREADY_USED 3
2656 #endif /* __DATASRC_H__ */
2657 
2658 #ifdef __cplusplus
2659 } /* extern "C" */
2660 #endif
2661 
DATASRCAPI void ds_add_binary_time_millis(ds_data_t *data, int32_t fieldnum, int64_t value)
Add a value to a data object in the form of a timestamp.
Definition: binary.c:553
DATASRCAPI int ds_del_except_event(ds_except_event_t *ev)
Remove a socket except event.
Definition: event.c:777
DATASRCAPI char * ds_log_getfilename(ds_log_t *log)
Get the filename of a log object.
Definition: log.c:1574
DATASRCAPI void ds_add_binary_opaque(ds_data_t *data, int32_t fieldnum, char *value, int len)
Add a value to a data object in the form of an opaque value.
Definition: binary.c:510
recv_update_t recv_update
Definition: datasrc.h:366
DATASRCAPI void ds_monitor_update_long(const char *templatename, const char *key, const char *propertyname, int32_t value)
Post an update to the monitoring system for a long value.
Definition: monitor.c:1519
DATASRCAPI ds_data_t * ds_init_container(const char *subject, const unsigned short flags)
Initialise a container object.
Definition: container.c:35
char * log_root
Definition: datasrc.h:361
DATASRCAPI void ds_add_data_float32(ds_data_t *data, int32_t fieldnum, float value)
Add a value to a data object in the form of a floating point number.
Definition: api.c:173
DATASRCAPI void ds_add_page_field_by_name(ds_data_t *data, const char *field, const char *value)
Add an arbitrary field to a page.
Definition: page.c:153
DATASRCAPI void ds_add_data_int16(ds_data_t *data, int32_t fieldnum, int16_t value)
Add a value to a data object in the form of a 16 bit integer.
Definition: api.c:261
DATASRCAPI sock_t ds_client_socket_nonblocking(const char *serv, unsigned short port)
Creates a client socket with which to connect to a host.
Definition: net.c:816
DATASRCAPI ds5_subscription_t * ds5_create_active_subscription(const char *subject, ds5_subscriptionlistener_t *listener, void *context)
Create a subscription that matches a single subject.
Definition: dsv5_subscription.c:131
DATASRCAPI void ds_config_add_bounded_array_option_enum(const char *longopt, const char *help, int type, void *value, int *num, ds_config_enum_t *enums, void *min, void *max)
Add an enumerated option to the configuration context.
Definition: config.c:728
DATASRCAPI int ds_isequal(ds_set_t *p1, ds_set_t *p2)
Check 2 peersets are equal.
Definition: peerset.c:182
DATASRCAPI int ds_replay_by_field_from_file(int fieldnum, char *value, recv_replay_t callback, char *filename)
Replays all data in a file that arrived after an update with the specified value for the specified fi...
Definition: replay.c:416
DATASRCAPI void ds5_publish_status(ds5_publisher_t *pub, const char *subject, int status, const char *message)
Publishes a subscription status event for a subject.
Definition: dsv5_publisher.c:330
unsigned short flags
Definition: datasrc.h:2524
void ds_printf(ds_log_t *log, const char *fmt,...)
Write a formatted string to a log object.
Definition: log.c:1112
Defines the DataSource initialisation object.
Definition: datasrc.h:357
DATASRCAPI void ds_add_container_symbol(ds_data_t *data, const char *symbol)
Add an object to the container.
Definition: container.c:54
DATASRCAPI void ds_write(ds_log_t *log, void *data, size_t len)
Write binary data to a log object.
Definition: log.c:1065
DATASRCAPI int ds_and_iszero(ds_set_t *p1, ds_set_t *p2)
Check if the bitwise and of 2 peer sets is 0.
Definition: peerset.c:123
DATASRCAPI int ds_replay_from_file(recv_replay_t callback, char *filename)
Replays all data in a file.
Definition: replay.c:141
DATASRCAPI int ds_fields_add(int num, const char *name, int flags, int dp, const char *fmt)
Add a new field to the field list.
Definition: fields.c:377
DATASRCAPI ds_config_ctx_t * ds_config_new_ctx(void)
Create a new configuration context.
Definition: config.c:201
struct _ds5_publisher_s ds5_publisher_t
Represents a data publisher that publishers to remote DataSource peers on behalf of a ds5_dataprovide...
Definition: datasrc.h:501
void(* recv_request_t)(int peer, int count, char **subjects, unsigned short flags)
Definition of the function type used for handling data requests.
Definition: datasrc.h:272
DATASRCAPI void DATASRCAPI void DATASRCAPI void ds_config_add_error_message(const char *msg)
Add a configuration error to the logfile.
Definition: config.c:3597
DATASRCAPI int ds5_init(int argc, char **argv)
Parses the DataSource configuration files and initialises the DataSource library. The configuration i...
Definition: dsv5.c:108
DATASRCAPI void ds_monitor_update_string(const char *templatename, const char *key, const char *propertyname, const char *value)
Post an update to the monitoring system for a string value.
Definition: monitor.c:1420
DATASRCAPI void ds_monitor_free_data(ds_monitor_t *data)
Deallocate memory used by the contents of a ds_monitor_t object.
Definition: monitor.c:541
DATASRCAPI ds_data_t * ds_init_listob(const char *subject, const unsigned short flags)
Initialise a list object.
Definition: listob.c:12
DATASRCAPI int32_t ds_add_record_char(ds_data_t *data, const char *field, char value)
Add a character value to a record object.
Definition: record.c:123
DATASRCAPI void ds_config_init(const char *file, int argc, char **argv)
Set up the configuration of the DataSource.
Definition: datasrc.c:329
int(* ds_monitor_authenticator_t)(ds_monauth_t *credentials)
Definition of the function type used for monitoring authentication callback.
Definition: datasrc.h:1512
void(* ds_loglevelchange_t)(ds_log_t *log, int new_level)
Callback used when the logging level of a log file is changed.
Definition: datasrc.h:1215
DATASRCAPI int ds_required_services_status(char *buf, size_t buflen)
Return whether all required services are ready.
Definition: advmap.c:6196
DATASRCAPI void ds_monitor_add_template_subscription(const char *templatename, const char *propertyname, const char *targettemplate, const char *description, const char *singleton, ds_monitor_active_cb callback_fn)
Add a subscription info into the template.
Definition: monitor.c:1175
DATASRCAPI ds_monitor_t * ds_monitor_new_double(const char *templatename, const char *key, const char *propertyname, double value)
Create a new ds_monitor_t object from an input double.
Definition: monitor.c:1823
char * application_root
Definition: datasrc.h:360
DATASRCAPI int ds_fields_max(void)
Return the number of fields that have been defined.
Definition: fields.c:359
DATASRCAPI void ds_send_data_to_peer(int peer, ds_data_t *data)
Send the data object to a specific peer.
Definition: api.c:589
DATASRCAPI int32_t ds_add_record_int(ds_data_t *data, const char *field, int value)
Add an integer value to a record object.
Definition: record.c:87
DATASRCAPI int ds_pipe(sock_t fds[2])
Creates a UNIX-style pipe.
Definition: net.c:1047
DATASRCAPI void ds_add_binary_float32(ds_data_t *data, int32_t fieldnum, float value)
Add a value to a data object in the form of a floating point number.
Definition: binary.c:223
DATASRCAPI double ds_timed_event_get_fire_time(ds_timed_event_t *ev)
Return the time the event is due to fire.
Definition: event.c:1420
DATASRCAPI ds_data_t * ds_clone_data(ds_data_t *data)
Create a clone of a data object.
Definition: api.c:1089
DATASRCAPI void ds_setnonblocking(sock_t fd)
Set a socket to be non-blocking.
Definition: net.c:1012
char * subject
Definition: datasrc.h:2507
DATASRCAPI void ds_monitor_add_template_relation(const char *templatename, const char *propertyname, const char *targettemplate, const char *description, int thisend_multiple, int thatend_multiple)
Add a relationship to a template.
Definition: monitor.c:1096
DATASRCAPI int ds_signature_check(char *key_id, char *token)
Provides a mechanism for validating a KeyMaster-generated encrypted single-use token.
Definition: signature.c:495
DATASRCAPI int32_t ds_add_record_str(ds_data_t *data, const char *field, const char *value)
Add a string value to a record object.
Definition: record.c:49
DATASRCAPI void ds5_publish_to_peer(ds5_publisher_t *publisher, int peernum, ds_data_t *dsdata)
Publish an update for a subject to the specified peer.
Definition: dsv5_publisher.c:263
DATASRCAPI void ds_set_status_down_to_peer(int peer)
Causes the DataSource to disconnect and not accept connections for this peer.
Definition: peer.c:4688
DATASRCAPI ds_data_t * ds_init_data(const char *subject, unsigned short type, unsigned short flags)
Initialise a data object for use.
Definition: api.c:60
DATASRCAPI void DATASRCAPI int ds_log_set_log_level(ds_log_t *log, const char *level)
Set the log level for a particular logfile.
Definition: log.c:2456
DATASRCAPI void ds_config_add_optional_file(const char *file)
Add an optional configuration file to the current configuration context.
Definition: config.c:388
DATASRCAPI void ds_config_add_section(const char *longopt, const char *help)
Adds a new configuration section to the current configuration context.
Definition: config.c:1002
DATASRCAPI sock_t ds_listen_socket(const char *addr, int port, int backlog)
Creates a listen socket on the specified local address and TCP port.
Definition: net.c:517
DATASRCAPI void ds_config_add_array_option_enum(const char *longopt, const char *help, int type, void *value, int *num, ds_config_enum_t *enums)
Add an enumerated option to the configuration context.
Definition: config.c:692
unsigned short seq
Definition: datasrc.h:2504
DATASRCAPI ds_write_event_t * ds_add_write_event(sock_t fd, ds_io_event_cb cb, int val, void *data)
Add a socket write event.
Definition: event.c:522
DATASRCAPI ds_timed_event_t * ds_add_periodic_event(int starttime, int period, int id, ds_timed_event_cb cb, int val, void *data)
Add a timed event, starting at a particular time.
Definition: event.c:1929
DATASRCAPI int ds_del_timed_event(ds_timed_event_t *ev)
Remove a timed event.
Definition: event.c:1386
DATASRCAPI char * ds_peer_name_r(int peer, char *buffer, size_t buflen)
Gets the name of a peer.
Definition: peer.c:8039
DATASRCAPI char * ds_peer_label_byindex_r(int peer, char *buffer, size_t buflen)
Get the peer label for a peer index.
Definition: peer.c:8108
DATASRCAPI ds_read_event_t * ds_add_read_event(sock_t fd, ds_io_event_cb cb, int val, void *data)
Add a socket read event.
Definition: event.c:491
DATASRCAPI void ds_replay_by_time(time_t t, recv_replay_t callback)
Replays all data in the current packet log file that arrived after a specified time.
Definition: replay.c:297
DATASRCAPI void ds_and(ds_set_t *p1, ds_set_t *p2, ds_set_t *a)
Combine 2 peersets using bitwise and.
Definition: peerset.c:98
DATASRCAPI void ds_add_news_topic_code(ds_data_t *data, const char *code)
Add a topic code to the news headline message.
Definition: news.c:141
DATASRCAPI char * ds_config_get_filename(void)
Return the current line number being parsed in the configuration file.
Definition: config.c:3744
DATASRCAPI void ds5_publish_to_peer_no_free(ds5_publisher_t *publisher, int peernum, ds_data_t *dsdata)
Publish an update for a subject to the specified peer. The update will not be freed.
Definition: dsv5_publisher.c:281
DATASRCAPI int ds_object_can_contrib(const char *name)
Determine whether contributions can be sent for this object.
Definition: advmap.c:5919
ds_monitor_t *(* ds_monitor_active_cb)(char *templatename, char *key, char *propertyname)
Definition of the function type used for active request callbacks.
Definition: datasrc.h:1487
DATASRCAPI void ds_add_data_uint32(ds_data_t *data, int32_t fieldnum, uint32_t value)
Add a value to a data object in the form of a 32 bit unsigned integer.
Definition: api.c:411
DATASRCAPI void ds_add_container_symbol_and_request(ds_data_t *data, const char *symbol, const int request)
Add an object to the container, indicating whether it should then be requested.
Definition: container.c:73
DATASRCAPI void ds_config_set_option(const char *name, const char *value)
Set a particular configuration option.
Definition: config.c:2346
DATASRCAPI void ds_config_add_file(const char *file)
Add a mandatory configuration file to the current configuration context.
Definition: config.c:370
DATASRCAPI void ds_free_data(ds_data_t *data)
Deallocates the memory used by a data object.
Definition: api.c:887
void(* recv_update_t)(int peer, ds_data_t *pkt)
Definition of the function type used for receiving updates from a DataSource peer.
Definition: datasrc.h:190
DATASRCAPI ds_except_event_t * ds_add_except_event(sock_t fd, ds_io_event_cb cb, int val, void *data)
Add a socket exception event.
Definition: event.c:559
DATASRCAPI ds_data_t * ds_init_permission(const char *subject, const char *key, unsigned short flags)
Initialise a data object as a permission object.
Definition: permission.c:77
DATASRCAPI ds5_namespace_t * ds5_create_regex_namespace(const char *expr)
Creates a DataSource namespace which will match subject names using a regular expression.
Definition: dsv5_namespace.c:276
DATASRCAPI char * ds_get_service(const char *name)
Return the service for an object.
Definition: advmap.c:5672
DATASRCAPI void ds_udpsignal_send_argv(const char *message, char *argv[])
Send a UDP message.
Definition: udpsignal.c:384
DATASRCAPI void ds_monitor_update_double(const char *templatename, const char *key, const char *propertyname, double value)
Post an update to the monitoring system for a double value.
Definition: monitor.c:1600
DATASRCAPI struct tm * ds_gmtime(void)
Get the current time in GMT.
Definition: event.c:1270
DATASRCAPI void ds_add_binary_int8(ds_data_t *data, int32_t fieldnum, int8_t value)
Add a value to a data object in the form of an 8 bit integer.
Definition: binary.c:281
DATASRCAPI void ds_monitor_end_template(const char *templatename)
End the definition of a template.
Definition: monitor.c:1067
DATASRCAPI void ds_config_add_group(const char *longopt, const char *help, void *base, void *def, size_t size, int *num)
Add a configuration group to the current configuration context.
Definition: config.c:882
DATASRCAPI int ds_peer_by_label(const char *label)
Return the peer index for a label.
Definition: peer.c:6172
DATASRCAPI void ds_config_free_ctx(ds_config_ctx_t *ctx)
Free a configuration context.
Definition: config.c:228
Enumerated types structure.
Definition: datasrc.h:935
DATASRCAPI void ds5_config_init(const char *configfile, int argc, char **argv)
Sets up the configuration of the DataSource.
Definition: dsv5.c:79
DATASRCAPI void ds_add_binary_int32(ds_data_t *data, int32_t fieldnum, int32_t value)
Add a value to a data object in the form of a 32 bit integer.
Definition: binary.c:328
DATASRCAPI void ds_send_data_no_free(ds_data_t *data)
Send the data object to all connected DataSource peers.
Definition: api.c:652
DATASRCAPI ds_data_t * ds_init_news(const char *subject, unsigned short flags)
Create a news headline message.
Definition: news.c:35
A field within a data update.
Definition: datasrc.h:2519
DATASRCAPI void ds_add_binary_timespec(ds_data_t *data, int32_t fieldnum, struct timespec value)
Add a value to a data object in the form of a timestamp.
Definition: binary.c:605
DATASRCAPI int ds_config_get_enum(const char *value, ds_config_enum_t *enums)
Get the value of an enumerated member.
Definition: config.c:1580
char * application_name
Definition: datasrc.h:359
DATASRCAPI int ds_peer_flags(int peer)
Gets the flags of a peer.
Definition: peer.c:1480
DATASRCAPI void ds_write_event_set_callback(ds_write_event_t *ev, ds_io_event_cb cb, int val, void *data)
Change the callback and callback values for a socket write event.
Definition: event.c:855
DATASRCAPI int32_t ds_add_record_fmt(ds_data_t *data, const char *field, const char *fmt,...)
Add a formatted string to a record object.
Definition: record.c:197
DATASRCAPI int ds_del_write_event(ds_write_event_t *ev)
Remove a socket write event.
Definition: event.c:717
DATASRCAPI ds_monitor_t * ds_monitor_new_long(const char *templatename, const char *key, const char *propertyname, int32_t value)
Create a new ds_monitor_t object from an input long.
Definition: monitor.c:1733
DATASRCAPI ds5_namespace_t * ds5_create_prefix_namespace(const char *prefix)
Creates a DataSource namespace which will match subject names based on their prefix.
Definition: dsv5_namespace.c:86
DATASRCAPI char * ds_fields_namebyindex(int index)
Return the field name of this index.
Definition: fields.c:622
DATASRCAPI void ds_monitor_create_group(const char *templatename, const char *key, const char *brief, const char *description)
Create a new monitoring group.
Definition: monitor.c:1348
DATASRCAPI void ds_add_data_uint64(ds_data_t *data, int32_t fieldnum, uint64_t value)
Add a value to a data object in the form of a 64 bit unsigned integer.
Definition: api.c:441
DATASRCAPI void DATASRCAPI void ds_cycle_all_logs(const char *suffix, long maxsize)
Cycle all log files in the application.
Definition: log.c:1397
DATASRCAPI int ds_udp_send(const char *data, int len, const char *addr, int port)
Sends data to a UDP address.
Definition: net.c:860
DATASRCAPI int ds_fields_getflags(int index)
Return the field flags of this index.
Definition: fields.c:662
DATASRCAPI void ds_monitor_start_template(const char *templatename, const char *description)
Start the defintion of a template.
Definition: monitor.c:976
DATASRCAPI void ds_add_permission_key(ds_data_t *data, const char *key)
Set the key for a permission object. Must be called either first, or immediately after inserting a se...
Definition: permission.c:101
DATASRCAPI void ds_config_add_bounded_option_enum(char sopt, const char *longopt, const char *help, int type, void *value, ds_config_enum_t *enums, void *min, void *max)
Add an enumerated option to the configuration context.
Definition: config.c:516
DATASRCAPI sock_t ds_udp_listen_socket(const char *p_interface, int port)
Creates a UDP listen socket.
Definition: net.c:691
DATASRCAPI void ds_config_add_option(char opt, const char *longopt, const char *help, int type, void *value)
Add a configuration option to the current configuration context.
Definition: config.c:421
DATASRCAPI void ds_add_binary_uint8(ds_data_t *data, int32_t fieldnum, uint8_t value)
Add a value to a data object in the form of an unsigned 8 bit integer.
Definition: binary.c:384
DATASRCAPI void ds_monitor_del_subscription(const char *templatename, const char *key, const char *propertyname, const char *value)
Delete a subscription between two groups.
Definition: monitor.c:1322
int(* ds_timed_event_cb)(int id, int val, void *data)
Definition of the callback for use with timed events.
Definition: datasrc.h:1058
DATASRCAPI void ds_add_news_datetime(ds_data_t *data, const char *datestr)
Add a date stamp to the news headline message.
Definition: news.c:87
The container object for monitoring array types.
Definition: datasrc.h:1406
DATASRCAPI void ds_add_listob_row_data(ds_data_t *data, const char *row_id, ds_data_t *row_fields)
Add the row type of the given row to the list object.
Definition: listob.c:94
DATASRCAPI void ds_monitor_delete_group(const char *templatename, const char *key)
Delete a group from the monitoring system.
Definition: monitor.c:1367
DATASRCAPI void ds_config_parse_args(int argc, char **argv, int *retargc)
Parse the configuration options from the command line arguments given.
Definition: config.c:2443
void(* recv_object_status_t)(int peer, char *subject, int status, unsigned short code, char *msgstr, ds_data_t *metadata)
Definition of the function type used for handling objectstatus messages.
Definition: datasrc.h:313
DATASRCAPI int ds_set_request_hint(const char *name, int num, char **hints)
Set the objects hint peers.
Definition: advmap.c:6000
DATASRCAPI void ds_config_set_test(const char *tag, char **value)
Adds a conditional test to the configuration file.
Definition: config.c:1133
DATASRCAPI void ds_config_list_options(void)
Print the options in the current configuration context to standard output.
Definition: config.c:3448
DATASRCAPI int ds_peer_local_type(int peer)
Gets the local type of a DataSource peer.
Definition: peer.c:1560
const char * name
Definition: datasrc.h:937
DATASRCAPI ds_udp_event_t * ds_add_udp_event(const char *command, ds_udp_event_cb cb, int val, void *data)
Add a udp event.
Definition: test_license.c:57
void(* recv_nodata_t)(int peer, char *subject, unsigned short flags)
Definition of the function type used for receiving "nodata" messages.
Definition: datasrc.h:228
DATASRCAPI char * ds_peer_name(int peer)
Gets the name of a peer.
Definition: peer.c:1452
DATASRCAPI void ds_set_subject(ds_data_t *data, const char *subject)
Sets a new name for the data object.
Definition: api.c:83
DATASRCAPI ds_log_t * ds_new_log(const char *name, const char *logname)
Create a new log object.
Definition: log.c:561
DATASRCAPI void ds5_add_connectionlistener(ds5_connectionlistener_t *connection_listener, void *context)
Adds a connection listener. The listener receives status events about the state of the DataSource app...
Definition: dsv5.c:280
void ds_config_add_config_reading_message_fmt(const char *fmt,...)
Handle a configuration loading message. Add a formatted message to the list of messages to be logged...
Definition: config.c:3547
void(* ds_logcycled_t)(ds_log_t *log)
Callback used when the log has cycled.
Definition: datasrc.h:1223
DATASRCAPI int ds_check_subnet(const char *s_address, const char *s_network, const char *s_netmask)
Check whether an address falls into a given network and netmask.
Definition: net.c:1153
int typeflags
Definition: datasrc.h:1454
DATASRCAPI ds5_namespace_t * ds5_create_globbed_namespace(const char *globbed)
Creates a DataSource namespace which will match subject names using globbing.
Definition: dsv5_namespace.c:138
DATASRCAPI void ds_monitor_del_relation(const char *templatename, const char *key, const char *propertyname, const char *targetkey)
Delete a relationship between two groups.
Definition: monitor.c:1263
void(* recv_peer_status_t)(int peer, int status, int val, void *data)
Definition of the function type used for receiving peer status messages.
Definition: datasrc.h:252
DATASRCAPI int ds_num_peers
The number of DataSource peers in your configuration. If discovery is enabled then this is set to be ...
Definition: peer.c:310
DATASRCAPI void ds_add_data_uint16(ds_data_t *data, int32_t fieldnum, uint16_t value)
Add a value to a data object in the form of a 16 bit unsigned integer.
Definition: api.c:381
DATASRCAPI void ds_add_binary_uint16(ds_data_t *data, int32_t fieldnum, uint16_t value)
Add a value to a data object in the form of an unsigned 16 bit integer.
Definition: binary.c:407
DATASRCAPI void ds_add_news_company_code(ds_data_t *data, const char *code)
Add a company code to the news headline message.
Definition: news.c:158
DATASRCAPI char * ds_debug_string(int level)
This function will convert a debug level into an appropriate string.
Definition: log.c:2058
DATASRCAPI void ds_add_data_uint8(ds_data_t *data, int32_t fieldnum, uint8_t value)
Add a value to a data object in the form of an 8 bit unsigned integer.
Definition: api.c:351
DATASRCAPI int ds_udp_sendto(const char *data, int len, struct sockaddr_storage *serv_addr)
Sends data to a UDP address.
Definition: net.c:892
DATASRCAPI int ds_object_available(const char *name)
Determine whether this object can theoretically be requested.
Definition: advmap.c:5827
DATASRCAPI int ds_fields_numbyname(const char *name)
Return the field number of this field.
Definition: fields.c:489
DATASRCAPI void ds_add_data_fmt(ds_data_t *data, int32_t fieldnum, const char *fmt,...)
Add a sprintf style format string to a data object.
Definition: api.c:127
DATASRCAPI void ds_set_timed_delay_next(ds_timed_event_t *ev, double delay)
Alter the next fire time for an existing timed event.
Definition: event.c:1532
DATASRCAPI int ds_request_objects(int count, char **obs, char ***services)
Request a number of objects in one go.
Definition: advmap.c:5346
DATASRCAPI char * ds_getnameinfo(const struct sockaddr_storage *addr, char *buf, size_t buflen)
return the string representation of the address passed in
Definition: net.c:295
DATASRCAPI int ds_peer_type(int peer)
Gets the type of a DataSource peer.
Definition: peer.c:1532
DATASRCAPI void ds_monitor_update_llong(const char *templatename, const char *key, const char *propertyname, int64_t value)
Post an update to the monitoring system for a long long value.
Definition: monitor.c:1558
DATASRCAPI void ds5_publish_subject_map(ds5_publisher_t *publisher, const char *subject, const char *mapped_to, int flags)
Publishes a subscription map event for a subject.
Definition: dsv5_publisher.c:361
DATASRCAPI void ds_add_data_int32(ds_data_t *data, int32_t fieldnum, int32_t value)
Add a value to a data object in the form of a 32 bit integer.
Definition: api.c:291
Monitoring credentials object.
Definition: datasrc.h:1495
An implementation of this interface allows applications to receive events raised for a ds5_subscripti...
Definition: datasrc.h:649
DATASRCAPI ds_monitor_t * ds_monitor_new(const char *propertyname, int type, int datasize, const void *datum)
Create a new ds_monitor_t object from input parameters.
Definition: monitor.c:591
DATASRCAPI void ds_add_binary_int64(ds_data_t *data, int32_t fieldnum, int64_t value)
Add a value to a data object in the form of a 64 bit integer.
Definition: binary.c:352
DATASRCAPI void ds_send_status_direct(const char *subject, unsigned short flags, unsigned short code, const char *msgstr)
Sends a user defined status message about a particular object.
Definition: api.c:939
DATASRCAPI void ds_add_binary(ds_data_t *data, int32_t fieldnum, char *value, int len, char type)
Adds a binary value to a data object.
Definition: binary.c:198
void ds_monitor_update_boolean(const char *templatename, const char *key, const char *propertyname, unsigned char value)
Post an update to the monitoring system for a boolean value.
Definition: monitor.c:1461
DATASRCAPI void ds_add_binary_int16(ds_data_t *data, int32_t fieldnum, int16_t value)
Add a value to a data object in the form of a 16 bit integer.
Definition: binary.c:304
DATASRCAPI int ds_peer_up(int peer)
Check to see if a peer is up.
Definition: peer.c:1621
DATASRCAPI void ds_add_data_char(ds_data_t *data, int32_t fieldnum, char value)
Add a value to a data object in the form of a character.
Definition: api.c:468
DATASRCAPI void ds_config_end_section(const char *longopt, const char *help)
Ends a configuration section.
Definition: config.c:1044
DATASRCAPI ds_logcycled_t ds_log_cycled_callback(ds_log_t *log, ds_logcycled_t cycle_cb)
Set the cycle callback for a given logfile.
Definition: log.c:2580
unsigned short count
Definition: datasrc.h:2508
DATASRCAPI void ds_config_add_array_option(const char *longopt, const char *help, int type, void *value, int *num)
Adds a configuration option to the current configuration context.
Definition: config.c:623
DATASRCAPI char * ds_request_object(const char *name)
Request an object.
Definition: advmap.c:5290
DATASRCAPI void ds_monitor_add_server_type(const char *type, const char *root)
Define The Server Type.
Definition: monitor.c:930
DATASRCAPI int ds_config_get_linenumber(void)
Return the name of current configuration file being parsed.
Definition: config.c:3774
struct _ds5_subscription_s ds5_subscription_t
Represents a subscription to a DataSource subject (see ds_create_active_subscription()) or to a names...
Definition: datasrc.h:634
DATASRCAPI int ds_udp_bind_client_socket(sock_t sock, const char *addr, int port)
Binds a UDP socket to a local address.
Definition: net.c:969
DATASRCAPI void ds_monitor_add_subscription(const char *templatename, const char *key, const char *propertyname, const char *value)
Add a subscription between two groups.
Definition: monitor.c:1298
DATASRCAPI int ds_signature_verify_username(char *expected_username, char *token)
Verify that the supplied token is for the expected username.
Definition: signature.c:885
recv_object_status_t recv_object_status
Definition: datasrc.h:372
DATASRCAPI void ds_set_status_down(void)
Causes the DataSource to disconnect and stop listening for connections.
Definition: peer.c:4577
DATASRCAPI void ds_reserve_std_fds(void)
Reserves the standard sockets for the std streams.
Definition: datasrc.c:283
DATASRCAPI void ds_cache_add_object(char *subject)
Add a new object to the cache.
Definition: cache.c:293
char * docstring
Definition: datasrc.h:1457
recv_service_status_t recv_service_status
Definition: datasrc.h:377
DATASRCAPI void ds_send_nodata_direct(const char *subject, unsigned short flags)
Send a "no data" message to all connected DataSource peers.
Definition: api.c:800
DATASRCAPI void DATASRCAPI void DATASRCAPI void ds_printf_time_ap(ds_log_t *log, const char *extra, const char *fmt, va_list ap)
Write a formatted string prefixed with a timestamp string to a log object.
Definition: log.c:1183
DATASRCAPI int ds_del_timed_event_free_data(ds_timed_event_t *ev, void(*free_data)(int, void *))
Remove a timed event.
Definition: event.c:1441
DATASRCAPI int ds_peer_by_local_label(const char *label)
Return the peer index for a local label.
Definition: peer.c:6192
DATASRCAPI void ds_add_binary_uint32(ds_data_t *data, int32_t fieldnum, uint32_t value)
Add a value to a data object in the form of an unsigned 32 bit integer.
Definition: binary.c:431
DATASRCAPI void ds_log_change_level_callback(ds_log_t *log, ds_loglevelchange_t change_cb)
Set the level change callback for a given logfile.
Definition: log.c:2564
DATASRCAPI void ds_monitor_add_template_member(const char *templatename, const char *propertyname, const char *description, int typeflags, ds_arguments_t *args, void *ptr)
Add a memeber to a template.
Definition: monitor.c:1012
int sock_t
The network socket datatype.
Definition: datasrc.h:127
char * description
Definition: datasrc.h:1456
Implement this interface to receive connection status information when using the DSv5 API...
Definition: datasrc.h:595
DATASRCAPI int ds_fields_indexbynum(int num)
Return the index of this field.
Definition: fields.c:579
void(* recv_replay_t)(int peer, ds_data_t *pkt, time_t tm)
Definition of the function type used for receiving updates from a the DataSource library when calling...
Definition: datasrc.h:208
DATASRCAPI void ds_monitor_add_data(ds_monitor_t *data, const void *datum)
Add an element to an array within a ds_monitor_t.
Definition: monitor.c:453
DATASRCAPI sock_t ds_client_socket(const char *serv, unsigned short port)
Creates a client socket with which to connect to a host.
Definition: net.c:844
DATASRCAPI void ds_add_latency_chain2(ds_data_t *dsdata, char suffix, struct timespec tp, char suffix2, struct timespec *tp2)
Function used to add two measurement points to latency chain data.
Definition: lty_chain.c:299
ds_field_t * fields
Definition: datasrc.h:2509
DATASRCAPI void ds_discard_object(const char *name)
Discard an object.
Definition: advmap.c:5487
unsigned short flags
Definition: datasrc.h:362
DATASRCAPI void ds_replay(recv_replay_t callback)
Replays all data in the current packet log file.
Definition: replay.c:177
DATASRCAPI void ds_set_status_up_to_peer(int peer)
Causes the DataSource to connect and accept connections.
Definition: peer.c:4989
DATASRCAPI int ds_replay_by_time_from_file(time_t t, recv_replay_t callback, char *filename)
Replays all data in a file that arrived after a specified time.
Definition: replay.c:323
DATASRCAPI char * ds_peer_label_byindex(int index)
Return the peer label for a peer index.
Definition: peer.c:6235
DATASRCAPI void ds_monitor_update(const char *templatename, const char *key, ds_monitor_t *mondata)
Post an update to the monitoring system for a string value.
Definition: monitor.c:1392
DATASRCAPI void ds_config_end_group(const char *longopt, const char *help)
Ends a configuration group.
Definition: config.c:962
DATASRCAPI char * ds_fields_namebynum(int num)
Return the field name of this field number.
Definition: fields.c:519
DATASRCAPI void ds_send_nodata(const char *subject, unsigned short flags)
Send a "no data" message to all connected DataSource peers.
Definition: api.c:777
DATASRCAPI void ds_config_add_bounded_array_option(const char *longopt, const char *help, int type, void *value, int *num, void *min, void *max)
Adds a configuration option to the current configuration context.
Definition: config.c:657
DATASRCAPI void ds_monitor_add_relation(const char *templatename, const char *key, const char *propertyname, const char *targetkey)
Add a relationship between two groups.
Definition: monitor.c:1238
DATASRCAPI void ds_thread_init(int event_module, int flags)
Initialise the event loop for this thread.
Definition: datasrc.c:1116
char * name
Definition: datasrc.h:1455
Definition of the interface that you should implement if you require custom subject matching logic...
Definition: datasrc.h:432
DATASRCAPI int ds_del_write_event_free_data(ds_write_event_t *ev, void(*free_data)(int, void *))
Remove a socket write event.
Definition: event.c:752
DATASRCAPI void ds5_publish_status_all(ds5_publisher_t *pub, int status, const char *message)
Publishes a subscription status event for all requested subjects.
Definition: dsv5_publisher.c:344
DATASRCAPI void ds_monitor_update_ullong(const char *templatename, const char *key, const char *propertyname, uint64_t value)
Post an update to the monitoring system for an unsigned long long value.
Definition: monitor.c:1539
DATASRCAPI void ds_set_timed_delay(ds_timed_event_t *ev, double delay)
Alter the delay for an existing timed event.
Definition: event.c:1512
DATASRCAPI void ds_config_del_test(const char *tag)
Delete a conditional test.
Definition: config.c:1167
DATASRCAPI void ds_add_news_headline(ds_data_t *data, const char *headline)
Add a news headline to the news headline message.
Definition: news.c:53
DATASRCAPI ds5_subscription_t * ds5_create_broadcast_subscription(ds5_namespace_t *nspace, ds5_subscriptionlistener_t *listener, void *context)
Create a subscription that matches multiple subjects.
Definition: dsv5_subscription.c:98
DATASRCAPI void ds_send_status(const char *subject, unsigned short flags, unsigned short code, const char *msgstr)
Sends a user defined status message about a particular object.
Definition: api.c:912
struct _ds_udp_event ds_udp_event_t
Opaque type defining a udp event.
Definition: datasrc.h:2549
DATASRCAPI void ds_delay_data(ds_delay_t *delay, ds_data_t *dsdata)
Add a data object to a delay channel.
Definition: delay.c:290
DATASRCAPI ds_log_t * ds_new_level_log(const char *name, const char *logname, ds_loglevelchange_t change_cb)
Create a new log object.
Definition: log.c:584
DATASRCAPI void ds_add_news_storycode(ds_data_t *data, const char *story)
Add a story code to the news object.
Definition: news.c:70
DATASRCAPI void ds_send_data_direct(ds_data_t *data)
Send the data object to all connected DataSource peers.
Definition: api.c:524
DATASRCAPI void ds_add_data_float64(ds_data_t *data, int32_t fieldnum, double value)
Add a value to a data object in the form of a floating point number.
Definition: api.c:201
DATASRCAPI void ds_add_binary_time(ds_data_t *data, int32_t fieldnum, time_t value)
Add a value to a data object in the form of a timestamp.
Definition: binary.c:533
DATASRCAPI ds_monitor_t * ds_monitor_new_llong(const char *templatename, const char *key, const char *propertyname, int64_t value)
Create a new ds_monitor_t object from an input long long.
Definition: monitor.c:1777
DATASRCAPI void ds_config_del_option(const char *longopt)
Remove an option from the current configuration context.
Definition: config.c:839
char * propertyname
Definition: datasrc.h:1429
void(* recv_discard_t)(int peer, int count, char **subjects, unsigned short flags)
Definition of the function type used for handling data discard requests.
Definition: datasrc.h:292
The container object for all monitoring values.
Definition: datasrc.h:1427
DATASRCAPI void * ds_get_object_data(const char *name)
Get an objects user data.
Definition: advmap.c:6170
DATASRCAPI void ds5_publish_subject_error(ds5_publisher_t *publisher, const char *subject, int flags)
Publishes a subscription error event for a subject.
Definition: dsv5_publisher.c:377
DATASRCAPI void ds_read_event_set_callback(ds_read_event_t *ev, ds_io_event_cb cb, int val, void *data)
Change the callback and callback values for a socket read event.
Definition: event.c:838
DATASRCAPI void ds_add_news_field(ds_data_t *dsdata, const char *fieldname, const char *value)
Add a custom field to a news headline message.
Definition: news.c:200
unsigned short flags
Definition: datasrc.h:2505
DATASRCAPI char * ds_log_getname(ds_log_t *log)
Get the name of a log object.
Definition: log.c:1592
DATASRCAPI int ds_peer_host_details(int peer, char **addr)
Gets details of the remote side of a peer.
Definition: peer.c:1393
Structure defining the arguments for Monitoring methods.
Definition: datasrc.h:1452
void(* ds_delay_send_cb)(void *context, ds_data_t *dsdata)
Definition of the callback for sending delayed data.
Definition: datasrc.h:2345
DATASRCAPI int ds_cycle_log(ds_log_t *log, const char *suffix, long maxsize)
Cycle a specific log file.
Definition: log.c:1428
struct _ds_log ds_log_t
The log file object.
Definition: datasrc.h:174
unsigned short type
Definition: datasrc.h:363
DATASRCAPI void ds_add_news_authstr(ds_data_t *data, const char *authstr)
Add an authorisation string to the news headline message.
Definition: news.c:107
DATASRCAPI ds_monitor_t * ds_monitor_new_short(const char *templatename, const char *key, const char *propertyname, int16_t value)
Create a new ds_monitor_t object from an input short.
Definition: monitor.c:1689
DATASRCAPI void ds_add_data_str(ds_data_t *data, int32_t fieldnum, const char *value)
Adds a string value to a data object.
Definition: api.c:154
void(* free)(ds5_namespace_t *nspace)
Invoked when the namespace should be deleted.
Definition: datasrc.h:439
DATASRCAPI void ds_replay_by_field(int fieldnum, char *value, recv_replay_t callback)
Replays all data in the current packet log file that arrived after an update with the specified value...
Definition: replay.c:388
DATASRCAPI ds_timed_event_t * ds_add_timed_event(int id, double delay, ds_timed_event_cb cb, int val, void *data)
Add a timed event.
Definition: event.c:1317
DATASRCAPI void ds_send_data(ds_data_t *data)
Send the data object to all connected DataSource peers.
Definition: api.c:499
struct _ds_peer_set ds_set_t
Defines a set of DataSource peers.
Definition: datasrc.h:152
DATASRCAPI void ds_not(ds_set_t *p)
Apply logical not to each peer in group.
Definition: peerset.c:25
DATASRCAPI void ds_writev(ds_log_t *log, struct iovec *vector, int count)
Write binary data to a log object.
Definition: log.c:1092
DATASRCAPI void ds_send_data_to_peer_no_free(int peer, ds_data_t *data)
Send the data object to a specific peer.
Definition: api.c:716
DATASRCAPI void ds_stop(void)
Definition: event.c:1214
DATASRCAPI void ds_config_add_group_with_info(const char *longopt, const char *help, void *base, void *def, size_t size, int *num, int file_offset, int line_offset)
Add a configuration group to the current configuration context.
Definition: config.c:910
ds_monitor_t * ds_monitor_new_boolean(const char *templatename, const char *key, const char *propertyname, unsigned char value)
Create a new ds_monitor_t object from an input boolean value.
Definition: monitor.c:1667
DATASRCAPI int ds_fields_getdp(int index)
Return the decimal precision of this index.
Definition: fields.c:679
DATASRCAPI void ds_set_status_msg_to_peer(int peer, unsigned short msgid, const char *msgstr)
Send a user-defined status message to peer.
Definition: peer.c:4822
struct _ds_timed_event ds_timed_event_t
Opaque type defining a timed event.
Definition: datasrc.h:1004
DATASRCAPI void ds_monitor_update_short(const char *templatename, const char *key, const char *propertyname, int16_t value)
Post an update to the monitoring system for a short value.
Definition: monitor.c:1480
void ds_config_add_error_message_fmt(const char *fmt,...)
Add a formatted error message to the logfile.
Definition: config.c:3515
DATASRCAPI sock_t ds_udp_client_socket(const char *addr, int port, struct sockaddr_storage *serv_addr)
Creates a UDP client socket.
Definition: net.c:925
DATASRCAPI void ds_monitor_free(ds_monitor_t *data)
Deallocate memory used by a ds_monitor_t object.
Definition: monitor.c:519
DATASRCAPI void ds_add_binary_timeval(ds_data_t *data, int32_t fieldnum, struct timeval value)
Add a value to a data object in the form of a timestamp.
Definition: binary.c:581
DATASRCAPI ds_log_t * ds_new_headed_log(const char *name, const char *logname, const char *header)
Create a new log object with a header.
Definition: log.c:950
DATASRCAPI void ds_send_status_to_peer(int peer, const char *subject, unsigned short flags, unsigned short code, const char *msgstr)
Sends a user defined status message about a particular object.
Definition: api.c:1000
DATASRCAPI void ds_add_listob_row_at_position(ds_data_t *data, int position, const char *row_id)
Insert a row within a list object at a particular position.
Definition: listob.c:50
DATASRCAPI int ds5_regex_namespace_add_expr(ds5_namespace_t *nspace, const char *expr, int exclude)
Adds a regular expression to a namespace.
Definition: dsv5_namespace.c:241
DATASRCAPI char ** ds_get_request_hints(const char *name, int *ret)
Return an objects request hints.
Definition: advmap.c:6079
DATASRCAPI ds_monitor_t * ds_monitor_new_ullong(const char *templatename, const char *key, const char *propertyname, uint64_t value)
Create a new ds_monitor_t object from an input unsigned long long.
Definition: monitor.c:1755
size_t size
Definition: datasrc.h:1407
DATASRCAPI void ds_set_status_up(void)
Causes the DataSource to connect and listen for connections.
Definition: peer.c:4938
DATASRCAPI int ds_check_periodic_event(int period, ds_timed_event_t **tev)
Check a periodic to ensure that it runs at the appropriate time regardless of summertime.
Definition: event.c:2210
DATASRCAPI void ds_loop(void)
Start the DataSource event loop.
Definition: event.c:1156
DATASRCAPI void ds_udpsignal_send(const char *message)
Send a udp message.
Definition: udpsignal.c:366
A data update object.
Definition: datasrc.h:2502
DATASRCAPI void ds_add_news_product_code(ds_data_t *data, const char *code)
Add a product code to the news headline message.
Definition: news.c:124
DATASRCAPI void ds5_unsubscribe(ds5_subscription_t *sub)
Unsubscribe from the DataSource subject or namespace of DataSource subjects.
Definition: dsv5_subscription.c:542
DATASRCAPI int ds_debug_level(const char *text)
This function will convert a string into an appropriate debug level.
Definition: log.c:2032
DATASRCAPI int ds_iszero(ds_set_t *p)
Check if any peer is set.
Definition: peerset.c:48
DATASRCAPI void ds5_publish_to_subscribed_peers_no_free(ds5_publisher_t *pub, ds_data_t *dsdata)
Publish an update for a subject to all peers that have subscribed. The update will not be freed...
Definition: dsv5_publisher.c:247
DATASRCAPI ds_delay_t * ds_new_delay(double delay_time, char *prefix, double batch_time)
Create a new delay channel.
Definition: delay.c:200
DATASRCAPI void ds_purge_object(const char *name)
Purge an object from our cache.
Definition: advmap.c:5968
DATASRCAPI int ds_log_flush(ds_log_t *log)
flush log buffers to disk
Definition: log.c:2427
DATASRCAPI int ds_request_objects_with_flags(int count, char **obs, int flags, char ***services)
Request a number of objects in one go.
Definition: advmap.c:5371
void(* recv_map_t)(int peer, char *from, char *to)
Definition of the function type used for handling map messages.
Definition: datasrc.h:337
DATASRCAPI int ds_peer_enabled_state(int peer)
Gets the enabled/disabled state of a DataSource peer.
Definition: peer.c:1592
void(* recv_service_status_t)(char *service, int status)
Definition of the function type used for handling service status messages.
Definition: datasrc.h:325
DATASRCAPI int ds_fields_indexbyname(const char *name)
Return the index of this field.
Definition: fields.c:546
DATASRCAPI void ds5_publish_to_subscribed_peers(ds5_publisher_t *pub, ds_data_t *dsdata)
Publish an update for a subject to all peers that have subscribed.
Definition: dsv5_publisher.c:230
DATASRCAPI ds_monitor_t * ds_monitor_new_string(const char *templatename, const char *key, const char *propertyname, const char *value)
Create a new ds_monitor_t object from an input string.
Definition: monitor.c:1623
DATASRCAPI void ds_add_news_user_code(ds_data_t *data, int codenum, const char *code)
Add a user defined code to the news headline message.
Definition: news.c:178
char * value
Definition: datasrc.h:2523
DATASRCAPI void ds_config_parse_files(void)
Parse all configuration files within the current configuration context.
Definition: config.c:2267
DATASRCAPI void ds_config_add_option_enum(char opt, const char *longopt, const char *help, int type, void *value, ds_config_enum_t *enums)
Add an enumerated option to the configuration context.
Definition: config.c:488
DATASRCAPI int ds_get_is_contrib_source(const char *name, int peer)
Check if the given peer is a contribution source for the symbol.
Definition: advmap.c:5725
DATASRCAPI void ds5_publish_response(ds5_publisher_t *pub, ds_data_t *dsdata)
Publish an initial response (for example, an image of the subject&#39;s data) following a request for a s...
Definition: dsv5_publisher.c:298
DATASRCAPI void ds_daemon_redirect(void)
Redirects the std* streams.
Definition: daemon.c:182
DATASRCAPI void ds_remove_container_symbol(ds_data_t *data, const char *symbol)
Remove an object from the container.
Definition: container.c:100
char * username
Definition: datasrc.h:1497
DATASRCAPI sock_t ds_accept_socket(sock_t fd)
Accepts a connection from a listen socket.
Definition: net.c:549
int(* ds_io_event_cb)(sock_t sock, int val, void *data)
Definition of the callback for use with read and write events.
Definition: datasrc.h:1046
DATASRCAPI ds5_publisher_t * ds5_create_broadcast_publisher(ds5_namespace_t *nspace)
Creates a data publisher that allows a DataSource application to broadcast updates to remote DataSour...
Definition: dsv5_publisher.c:806
DATASRCAPI void ds_add_data_int64(ds_data_t *data, int32_t fieldnum, int64_t value)
Add a value to a data object in the form of a 64 bit integer.
Definition: api.c:321
DATASRCAPI ds_monitor_t * ds_monitor_new_array(const char *propertyname, int type)
Create a new ds_monitor_t of an array type.
Definition: monitor.c:431
DATASRCAPI void ds5_publish_response_no_free(ds5_publisher_t *pub, ds_data_t *dsdata)
Publish an initial response (for example, an image of the subject&#39;s data) following a request for a s...
Definition: dsv5_publisher.c:314
DATASRCAPI void ds_config_add_search(const char *path)
Add a directory in which to search for configuration files.
Definition: config.c:313
DATASRCAPI void ds_add_listob_row(ds_data_t *data, const char *row_id)
Add a row to the list object.
Definition: listob.c:31
unsigned short type
Definition: datasrc.h:2506
DATASRCAPI ds5_publisher_t * ds5_create_compatibility_publisher(ds5_namespace_t *nspace, ds5_dataprovider_t *provider, void *context)
Creates a data publisher that, for a given subject sends multiple subscription requests and multiple ...
Definition: dsv5_publisher.c:183
DATASRCAPI ds_data_t * ds_init_binaryob(const char *subject, const unsigned short flags)
Initialise a binary object.
Definition: binary.c:1090
DATASRCAPI void ds_replay_by_time_from_log(time_t t, recv_replay_t callback, ds_log_t *log)
Replays all data in a log object that arrived after a specified time.
Definition: replay.c:342
DATASRCAPI void ds_replay_from_log(recv_replay_t callback, ds_log_t *log)
Replays all data in a packet log file.
Definition: replay.c:155
DATASRCAPI ds_monitor_t * ds_monitor_new_timestamp(const char *templatename, const char *key, const char *propertyname, int64_t value)
Create a new ds_monitor_t object from an input timestamp.
Definition: monitor.c:1799
DATASRCAPI void ds_set_status_msg(unsigned short msgid, const char *msgstr)
Send a user-defined status message to all connected peers.
Definition: peer.c:4744
struct _ds_io_event ds_write_event_t
Opaque type defining a write event.
Definition: datasrc.h:1026
DATASRCAPI char * ds_filename_expand(const char *format, char *buffer, size_t bufsize)
Expand a filename pattern into a fully qualified filename.
Definition: datasrc.c:1394
double value
Definition: datasrc.h:938
DATASRCAPI ds_log_t * ds_get_event_log(void)
Returns a handle to the event log used by Datasource for C.
Definition: datasrc.c:1576
recv_request_t recv_request
Definition: datasrc.h:364
DATASRCAPI ds_config_ctx_t * ds_config_set_ctx(ds_config_ctx_t *ctx)
Sets a configuration context as the current one.
Definition: config.c:292
char * password
Definition: datasrc.h:1498
struct _config_ctx ds_config_ctx_t
The configuration context data type.
Definition: datasrc.h:169
DATASRCAPI void ds_del_udp_event(ds_udp_event_t *event)
Remove a timed event.
Definition: udpsignal.c:189
DATASRCAPI int ds_send_contribution(ds_data_t *dsdata)
Contribute an object back to the peers that supplied it and support it.
Definition: advmap.c:5594
recv_map_t recv_map
Definition: datasrc.h:378
DATASRCAPI void ds_config_list_values(void)
Print the options and values in the current configuration context to standard output.
Definition: config.c:3462
Interface that must be implemented in order to receive subscirption request and subscription discard ...
Definition: datasrc.h:519
DATASRCAPI int ds_peer_all_type(int flag)
Checks if a DataSource peer of the given type is in your configuration file.
Definition: peer.c:1746
int32_t fieldnum
Definition: datasrc.h:2521
recv_peer_status_t recv_peer_status
Definition: datasrc.h:368
char * logfile
Definition: datasrc.h:381
DATASRCAPI void ds_monitor_update_ulong(const char *templatename, const char *key, const char *propertyname, uint32_t value)
Post an update to the monitoring system for an unsigned long value.
Definition: monitor.c:1500
ds_log_t * log
Definition: datasrc.h:382
DATASRCAPI ds_monitor_authenticator_t ds_monitor_set_auth(ds_monitor_authenticator_t authenticator)
Register a new authentication handler.
Definition: monitor.c:1844
struct _ds_io_event ds_except_event_t
Opaque type defining an exception event.
Definition: datasrc.h:1011
DATASRCAPI char * ds_request_object_with_flags(const char *name, int flags)
Request an object.
Definition: advmap.c:5309
struct _ds_io_event ds_read_event_t
Opaque type defining a read event.
Definition: datasrc.h:1019
DATASRCAPI void ds_add_latency_initial_timestamp(ds_data_t *dsdata)
Sets the initial time for latency chaining.
Definition: lty_chain.c:352
DATASRCAPI void ds_add_data_int8(ds_data_t *data, int32_t fieldnum, int8_t value)
Add a value to a data object in the form of an 8 bit integer.
Definition: api.c:231
DATASRCAPI void ds_add_latency_chain(ds_data_t *dsdata, char suffix, struct timespec *tp)
function used to add a measurement point to latency chain data
Definition: lty_chain.c:247
DATASRCAPI ds_timed_event_t * ds_add_periodic_event_from_time(time_t then, int starttime, int period, int id, ds_timed_event_cb cb, int val, void *data)
Add a timed event, starting at a particular offset from a given time.
Definition: event.c:2115
DATASRCAPI void ds_add_binary_string(ds_data_t *data, int32_t fieldnum, char *value)
Add a value to a data object in the form of a string.
Definition: binary.c:484
DATASRCAPI char * ds_debug_config_string(int level)
This function will convert a debug level into an appropriate string.
Definition: log.c:2090
void(* ds_config_func)(char *name, int num, char **values)
Definition of function type used for configuration callbacks.
Definition: datasrc.h:956
DATASRCAPI int ds_config_parse_file(const char *unresolved_filename)
Parse a single configuration file within the configuration context.
Definition: config.c:2619
DATASRCAPI void ds_cleardown_container_with_prefix(ds_data_t *data, const char *prefix)
Remove a set of symbols from the container.
Definition: container.c:139
DATASRCAPI int ds_get_gmt_offset(time_t t)
Calculate offset between local time and gmt.
Definition: event.c:1950
DATASRCAPI void ds_add_binary_uint64(ds_data_t *data, int32_t fieldnum, uint64_t value)
Add a value to a data object in the form of an unsigned 64 bit integer.
Definition: binary.c:455
DATASRCAPI int ds_and3_iszero(ds_set_t *p1, ds_set_t *p2, ds_set_t *p3)
Check if the bitwise and of 3 peer sets is 0.
Definition: peerset.c:153
DATASRCAPI int ds_del_read_event(ds_read_event_t *ev)
Remove a socket read event.
Definition: event.c:657
int32_t len
Definition: datasrc.h:2522
DATASRCAPI int ds_log_get_level(ds_log_t *log)
Get the current loglevel for the given logfile.
Definition: log.c:2596
DATASRCAPI void ds_or(ds_set_t *p1, ds_set_t *p2, ds_set_t *o)
Combine 2 peersets using bitwise or.
Definition: peerset.c:75
struct _ds_io_event ds_generic_event_t
Opaque type defining a generic read/write event.
Definition: datasrc.h:1033
void ds_log(ds_log_t *log, int level, const char *fmt,...)
Write a formatted string prefixed with log level and timestamp to the log object. ...
Definition: log.c:2204
DATASRCAPI int ds_daemon_disabled(void)
Check whether the application is running in daemon mode.
Definition: daemon.c:201
recv_nodata_t recv_nodata
Definition: datasrc.h:367
DATASRCAPI int ds_peer_host_details_r(int peer, char *buffer, size_t buflen)
Gets details of the remote side of a peer. User must provide buffer for the address.
Definition: peer.c:7999
DATASRCAPI int ds_init(ds_init_t *init, int argc, char **argv)
Parse the configuration files and initialise the DataSource library.
Definition: datasrc.c:574
DATASRCAPI int ds_peer_details(int peer, char **name)
Gets the ID and name of a peer.
Definition: peer.c:1363
char * ipaddress
Definition: datasrc.h:1499
DATASRCAPI int32_t ds_add_record_float(ds_data_t *data, const char *field, double value)
Add a floating point value to a record object.
Definition: record.c:160
void ds_printf_time(ds_log_t *log, const char *fmt,...)
Write a formatted string prefixed with a timestamp string to a log object.
Definition: log.c:1158
DATASRCAPI void ds_send_nodata_to_peer(int peer, const char *subject, unsigned short flags)
Send a "no data" message to a specific DataSource pper.
Definition: api.c:848
DATASRCAPI void ds_discard_objects(int count, char **obs)
Discard a number of objects.
Definition: advmap.c:5529
DATASRCAPI void ds_timed_event_set_callback(ds_timed_event_t *ev, ds_timed_event_cb cb, int val, void *data)
Change the callback and callback values for a timed eent.
Definition: event.c:1686
DATASRCAPI int ds_get_service_by_index(int index, char **name_ptr)
Return the name/state of a service by index.
Definition: advmap.c:5800
DATASRCAPI void ds_replay_by_field_from_log(int fieldnum, char *value, recv_replay_t callback, ds_log_t *log)
Replays all data in the log object that arrived after an update with the specified value for the spec...
Definition: replay.c:440
struct _ds_delay ds_delay_t
The delay channel object type.
Definition: datasrc.h:163
DATASRCAPI void ds_remove_listob_row(ds_data_t *data, const char *row_id, char clear)
Remove a row from the list object.
Definition: listob.c:69
DATASRCAPI ds_monitor_t * ds_monitor_new_ushort(const char *templatename, const char *key, const char *propertyname, uint16_t value)
Create a new ds_monitor_t object from an input unsigned short.
Definition: monitor.c:1645
DATASRCAPI void ds_config_add_bounded_option(char sopt, const char *longopt, const char *help, int type, void *value, void *min, void *max)
Add a bounded configuration option to the current configuration context.
Definition: config.c:459
DATASRCAPI void ds_add_container_symbol_at_position(ds_data_t *data, int position, const char *symbol)
Insert an object within a container at a particular position.
Definition: container.c:119
int(* ds_udp_event_cb)(int argc, char *argv[], int val, void *data)
Definition of the callback for use with udp events.
Definition: datasrc.h:2562
DATASRCAPI struct sockaddr_storage * ds_gethostsockaddr(const char *name, struct sockaddr_storage *populate)
Return the socket address for a given hostname.
Definition: net.c:247
DATASRCAPI time_t ds_get_time(void)
Gets the current time in seconds.
Definition: event.c:1257
void ds_syslog(ds_log_t *log, int level, const char *fmt,...)
Write a formatted string to a log object and to the system log.
Definition: log.c:1256
const char * docstring
Definition: datasrc.h:939
DATASRCAPI int ds_del_except_event_free_data(ds_except_event_t *ev, void(*free_data)(int, void *))
Remove a socket except event.
Definition: event.c:811
int(* match)(ds5_namespace_t *nspace, const char *subject)
Tests a subject to see if it falls within this namespace.
Definition: datasrc.h:449
DATASRCAPI void ds_add_binary_float64(ds_data_t *data, int32_t fieldnum, double value)
Add a value to a data object in the form of a floating point number.
Definition: binary.c:249
DATASRCAPI ds5_publisher_t * ds5_create_active_publisher(ds5_namespace_t *nspace, ds5_dataprovider_t *provider, void *context)
Creates a data publisher that for a given subject sends multiple subscription requests and a single s...
Definition: dsv5_publisher.c:125
DATASRCAPI int ds_peer_details_r(int peer, char *buffer, size_t buflen)
Gets the ID and name of a peer. User must provide buffer for the name.
Definition: peer.c:7961
DATASRCAPI ds_delay_t * ds_new_delay_with_callback(double delay_time, char *prefix, double batch_time, void *callback_param, ds_delay_send_cb callback_func)
Create a new delay channel.
Definition: delay.c:238
DATASRCAPI ds_data_t * ds_init_page(const char *subject, int rows, int cols, const char *type, unsigned short flags)
Initialise a data object as a page.
Definition: page.c:62
DATASRCAPI void ds_add_page_field(ds_data_t *data, int32_t fieldnum, const char *value)
Add an arbitrary field to a page.
Definition: page.c:126
int datatype
Definition: datasrc.h:1430
DATASRCAPI void ds_monitor_update_timestamp(const char *templatename, const char *key, const char *propertyname, int64_t value)
Post an update to the monitoring system for a timestamp value.
Definition: monitor.c:1577
recv_discard_t recv_discard
Definition: datasrc.h:365
DATASRCAPI void ds_add_page_row(ds_data_t *data, int row, int col, const char *str)
Add a row of data to a page data object.
Definition: page.c:100
DATASRCAPI sock_t ds_multicast_listen_socket(const char *p_interface, const char *addr, int port)
Creates a multicast listen socket.
Definition: net.c:571
DATASRCAPI int ds_get_num_services(void)
Return the number of services.
Definition: advmap.c:5783
DATASRCAPI ds_monitor_t * ds_monitor_new_ulong(const char *templatename, const char *key, const char *propertyname, uint32_t value)
Create a new ds_monitor_t object from an input unsigned long.
Definition: monitor.c:1711
DATASRCAPI int ds_del_read_event_free_data(ds_read_event_t *ev, void(*free_data)(int, void *))
Remove a socket read event.
Definition: event.c:692
DATASRCAPI int ds_fields_numbyindex(int index)
Return the field number of this index.
Definition: fields.c:604
DATASRCAPI void ds_free_log(ds_log_t *log)
Destroy a log object.
Definition: log.c:980
DATASRCAPI void ds_monitor_update_ushort(const char *templatename, const char *key, const char *propertyname, uint16_t)
Post an update to the monitoring system for an unsigned short value.
Definition: monitor.c:1441
DATASRCAPI struct tm * ds_localtime(void)
Get the current time in the local timezone.
Definition: event.c:1283
DATASRCAPI void ds_set_object_data(const char *name, void *data)
Set an objects user data.
Definition: advmap.c:6126
DATASRCAPI int ds_peer_id(int peer)
Gets the ID of a peer.
Definition: peer.c:1421
DATASRCAPI void ds_add_data(ds_data_t *data, int32_t fieldnum, const char *value)
Adds a string value to a data object.
Definition: api.c:108

Generated on Thu May 14 2026 09:41:00 for DataSource for C SDK