00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #include <time.h>
00029 #include <sys/types.h>
00030 #include <signal.h>
00031 #include "mem/mem.h"
00032 #include "mem/shm_mem.h"
00033 #include "sr_module.h"
00034 #include "dprint.h"
00035 #include "core_cmd.h"
00036 #include "globals.h"
00037 #include "pt.h"
00038 #include "ut.h"
00039 #include "tcp_info.h"
00040 #include "tcp_options.h"
00041 #include "core_cmd.h"
00042 #ifdef USE_SCTP
00043 #include "sctp_options.h"
00044 #include "sctp_server.h"
00045 #endif
00046
00047 #ifdef USE_DNS_CACHE
00048 void dns_cache_debug(rpc_t* rpc, void* ctx);
00049 void dns_cache_debug_all(rpc_t* rpc, void* ctx);
00050 void dns_cache_mem_info(rpc_t* rpc, void* ctx);
00051 void dns_cache_view(rpc_t* rpc, void* ctx);
00052 void dns_cache_delete_all(rpc_t* rpc, void* ctx);
00053 void dns_cache_add_a(rpc_t* rpc, void* ctx);
00054 void dns_cache_add_aaaa(rpc_t* rpc, void* ctx);
00055 void dns_cache_add_srv(rpc_t* rpc, void* ctx);
00056 void dns_cache_delete_a(rpc_t* rpc, void* ctx);
00057 void dns_cache_delete_aaaa(rpc_t* rpc, void* ctx);
00058 void dns_cache_delete_srv(rpc_t* rpc, void* ctx);
00059
00060
00061 static const char* dns_cache_mem_info_doc[] = {
00062 "dns cache memory info.",
00063 0
00064 };
00065 static const char* dns_cache_debug_doc[] = {
00066 "dns debug info.",
00067 0
00068 };
00069
00070 static const char* dns_cache_debug_all_doc[] = {
00071 "complete dns debug dump",
00072 0
00073 };
00074
00075 static const char* dns_cache_view_doc[] = {
00076 "dns cache dump in a human-readable format",
00077 0
00078 };
00079
00080 static const char* dns_cache_delete_all_doc[] = {
00081 "deletes all the entries from the DNS cache",
00082 0
00083 };
00084
00085 static const char* dns_cache_add_a_doc[] = {
00086 "adds an A record to the DNS cache",
00087 0
00088 };
00089
00090 static const char* dns_cache_add_aaaa_doc[] = {
00091 "adds an AAAA record to the DNS cache",
00092 0
00093 };
00094 static const char* dns_cache_add_srv_doc[] = {
00095 "adds an SRV record to the DNS cache",
00096 0
00097 };
00098
00099 static const char* dns_cache_delete_a_doc[] = {
00100 "deletes an A record from the DNS cache",
00101 0
00102 };
00103
00104 static const char* dns_cache_delete_aaaa_doc[] = {
00105 "deletes an AAAA record from the DNS cache",
00106 0
00107 };
00108
00109 static const char* dns_cache_delete_srv_doc[] = {
00110 "deletes an SRV record from the DNS cache",
00111 0
00112 };
00113
00114 #ifdef USE_DNS_CACHE_STATS
00115 void dns_cache_stats_get(rpc_t* rpc, void* ctx);
00116
00117 static const char* dns_cache_stats_get_doc[] = {
00118 "returns the dns measurement counters.",
00119 0
00120 };
00121 #endif
00122 #ifdef DNS_WATCHDOG_SUPPORT
00123 void dns_set_server_state_rpc(rpc_t* rpc, void* ctx);
00124
00125 static const char* dns_set_server_state_doc[] = {
00126 "sets the state of the DNS servers " \
00127 "(0: all the servers are down, 1: at least one server is up)",
00128 0
00129 };
00130
00131 void dns_get_server_state_rpc(rpc_t* rpc, void* ctx);
00132
00133 static const char* dns_get_server_state_doc[] = {
00134 "prints the state of the DNS servers " \
00135 "(0: all the servers are down, 1: at least one server is up)",
00136 0
00137 };
00138
00139 #endif
00140 #endif
00141 #ifdef USE_DST_BLACKLIST
00142 void dst_blst_debug(rpc_t* rpc, void* ctx);
00143 void dst_blst_mem_info(rpc_t* rpc, void* ctx);
00144 void dst_blst_view(rpc_t* rpc, void* ctx);
00145 void dst_blst_delete_all(rpc_t* rpc, void* ctx);
00146 void dst_blst_add(rpc_t* rpc, void* ctx);
00147
00148 static const char* dst_blst_mem_info_doc[] = {
00149 "dst blacklist memory usage info.",
00150 0
00151 };
00152 static const char* dst_blst_debug_doc[] = {
00153 "dst blacklist debug info.",
00154 0
00155 };
00156 static const char* dst_blst_view_doc[] = {
00157 "dst blacklist dump in human-readable format.",
00158 0
00159 };
00160 static const char* dst_blst_delete_all_doc[] = {
00161 "Deletes all the entries from the dst blacklist except the permanent ones.",
00162 0
00163 };
00164 static const char* dst_blst_add_doc[] = {
00165 "Adds a new entry to the dst blacklist.",
00166 0
00167 };
00168 #ifdef USE_DST_BLACKLIST_STATS
00169 void dst_blst_stats_get(rpc_t* rpc, void* ctx);
00170
00171 static const char* dst_blst_stats_get_doc[] = {
00172 "returns the dst blacklist measurement counters.",
00173 0
00174 };
00175 #endif
00176
00177 #endif
00178
00179
00180
00181 #define MAX_CTIME_LEN 128
00182
00183
00184 static char up_since_ctime[MAX_CTIME_LEN];
00185
00186
00187 static const char* system_listMethods_doc[] = {
00188 "Lists all RPC methods supported by the server.",
00189 0
00190 };
00191
00192 static void system_listMethods(rpc_t* rpc, void* c)
00193 {
00194 struct sr_module* t;
00195 rpc_export_t* ptr;
00196
00197 for(ptr = core_rpc_methods; ptr && ptr->name; ptr++) {
00198 if (rpc->add(c, "s", ptr->name) < 0) return;
00199 }
00200
00201 for(t = modules; t; t = t->next) {
00202 for(ptr = t->exports->rpc_methods; ptr && ptr->name; ptr++) {
00203 if (rpc->add(c, "s", ptr->name) < 0) return;
00204 }
00205 }
00206 }
00207
00208 static const char* system_methodSignature_doc[] = {
00209 "Returns signature of given method.",
00210 0
00211 };
00212
00213 static void system_methodSignature(rpc_t* rpc, void* c)
00214 {
00215 rpc->fault(c, 500, "Not Implemented Yet");
00216 }
00217
00218
00219 static const char* system_methodHelp_doc[] = {
00220 "Print the help string for given method.",
00221 0
00222 };
00223
00224 static void system_methodHelp(rpc_t* rpc, void* c)
00225 {
00226 struct sr_module* t;
00227 rpc_export_t* ptr;
00228 char* name;
00229
00230 if (rpc->scan(c, "s", &name) < 1) {
00231 rpc->fault(c, 400, "Method Name Expected");
00232 return;
00233 }
00234
00235 for(t = modules; t; t = t->next) {
00236 for(ptr = t->exports->rpc_methods; ptr && ptr->name; ptr++) {
00237 if (strcmp(name, ptr->name) == 0) {
00238 if (ptr->doc_str && ptr->doc_str[0]) {
00239 rpc->add(c, "s", ptr->doc_str[0]);
00240 } else {
00241 rpc->add(c, "s", "undocumented");
00242 }
00243 return;
00244 }
00245 }
00246 }
00247
00248 for (ptr=core_rpc_methods;ptr && ptr->name; ptr++){
00249 if (strcmp(name, ptr->name) == 0) {
00250 if (ptr->doc_str && ptr->doc_str[0]) {
00251 rpc->add(c, "s", ptr->doc_str[0]);
00252 } else {
00253 rpc->add(c, "s", "undocumented");
00254 }
00255 return;
00256 }
00257 }
00258 rpc->fault(c, 400, "command not found");
00259 }
00260
00261
00262 static const char* core_prints_doc[] = {
00263 "Returns the string given as parameter.",
00264 0
00265 };
00266
00267
00268 static void core_prints(rpc_t* rpc, void* c)
00269 {
00270 char* string = 0;
00271 if (rpc->scan(c, "s", &string)>0)
00272 rpc->add(c, "s", string);
00273 }
00274
00275
00276 static const char* core_version_doc[] = {
00277 "Returns the version string of the server.",
00278 0
00279 };
00280
00281 static void core_version(rpc_t* rpc, void* c)
00282 {
00283 rpc->add(c, "s", SERVER_HDR);
00284 }
00285
00286
00287
00288 static const char* core_uptime_doc[] = {
00289 "Returns uptime of SER server.",
00290 0
00291 };
00292
00293
00294 static void core_uptime(rpc_t* rpc, void* c)
00295 {
00296 void* s;
00297 time_t now;
00298
00299 time(&now);
00300
00301 if (rpc->add(c, "{", &s) < 0) return;
00302 rpc->struct_add(s, "s", "now", ctime(&now));
00303 rpc->struct_add(s, "s", "up_since", up_since_ctime);
00304
00305
00306
00307
00308 rpc->struct_add(s, "d", "uptime", (int)(now-up_since));
00309 }
00310
00311
00312 static const char* core_ps_doc[] = {
00313 "Returns the description of running SER processes.",
00314 0
00315 };
00316
00317
00318 static void core_ps(rpc_t* rpc, void* c)
00319 {
00320 int p;
00321
00322 for (p=0; p<*process_count;p++) {
00323 rpc->add(c, "d", pt[p].pid);
00324 rpc->add(c, "s", pt[p].desc);
00325 }
00326 }
00327
00328
00329 static const char* core_pwd_doc[] = {
00330 "Returns the working directory of SER server.",
00331 0
00332 };
00333
00334
00335 static void core_pwd(rpc_t* rpc, void* c)
00336 {
00337 char *cwd_buf;
00338 int max_len;
00339
00340 max_len = pathmax();
00341 cwd_buf = pkg_malloc(max_len);
00342 if (!cwd_buf) {
00343 ERR("core_pwd: No memory left\n");
00344 rpc->fault(c, 500, "Server Ran Out of Memory");
00345 return;
00346 }
00347
00348 if (getcwd(cwd_buf, max_len)) {
00349 rpc->add(c, "s", cwd_buf);
00350 } else {
00351 rpc->fault(c, 500, "getcwd Failed");
00352 }
00353 pkg_free(cwd_buf);
00354 }
00355
00356
00357 static const char* core_arg_doc[] = {
00358 "Returns the list of command line arguments used on SER startup.",
00359 0
00360 };
00361
00362
00363 static void core_arg(rpc_t* rpc, void* c)
00364 {
00365 int p;
00366
00367 for (p = 0; p < my_argc; p++) {
00368 if (rpc->add(c, "s", my_argv[p]) < 0) return;
00369 }
00370 }
00371
00372
00373 static const char* core_kill_doc[] = {
00374 "Sends the given signal to SER.",
00375 0
00376 };
00377
00378
00379 static void core_kill(rpc_t* rpc, void* c)
00380 {
00381 int sig_no = 15;
00382 rpc->scan(c, "d", &sig_no);
00383 rpc->send(c);
00384 kill(0, sig_no);
00385 }
00386
00387 static void core_shmmem(rpc_t* rpc, void* c)
00388 {
00389 struct mem_info mi;
00390 void *handle;
00391
00392 shm_info(&mi);
00393 rpc->add(c, "{", &handle);
00394 rpc->struct_add(handle, "dddddd",
00395 "total", (unsigned int)mi.total_size,
00396 "free", (unsigned int)mi.free,
00397 "used", (unsigned int)mi.used,
00398 "real_used",(unsigned int)mi.real_used,
00399 "max_used", (unsigned int)mi.max_used,
00400 "fragments", (unsigned int)mi.total_frags
00401 );
00402 }
00403
00404 static const char* core_shmmem_doc[] = {
00405 "Returns shared memory info.",
00406 0
00407 };
00408
00409
00410 #if defined(SF_MALLOC) || defined(LL_MALLOC)
00411 static void core_sfmalloc(rpc_t* rpc, void* c)
00412 {
00413 void *handle;
00414 int i,r;
00415 unsigned long frags, main_s_frags, main_b_frags, pool_frags;
00416 unsigned long misses;
00417 unsigned long max_misses;
00418 unsigned long max_frags;
00419 unsigned long max_mem;
00420 int max_frags_pool, max_frags_hash;
00421 int max_misses_pool, max_misses_hash;
00422 int max_mem_pool, max_mem_hash;
00423 unsigned long mem;
00424
00425 if (rpc->scan(c, "d", &r) >= 1) {
00426 if (r>=(int)SF_HASH_POOL_SIZE){
00427 rpc->fault(c, 500, "invalid hash number %d (max %d)",
00428 r, (unsigned int)SF_HASH_POOL_SIZE-1);
00429 return;
00430 }else if (r<0) goto all;
00431 rpc->add(c, "{", &handle);
00432 rpc->struct_add(handle, "dd",
00433 "hash ", r,
00434 "size ", r*SF_ROUNDTO);
00435 for (i=0; i<SFM_POOLS_NO; i++){
00436 rpc->struct_add(handle, "dddd",
00437 "pool ", i,
00438 "frags ", (unsigned int)shm_block->pool[i].pool_hash[r].no,
00439 "misses", (unsigned int)shm_block->pool[i].pool_hash[r].misses,
00440 "mem ", (unsigned int)shm_block->pool[i].pool_hash[r].no *
00441 r*SF_ROUNDTO
00442 );
00443 }
00444 }
00445 return;
00446 all:
00447 max_frags=max_misses=max_mem=0;
00448 max_frags_pool=max_frags_hash=0;
00449 max_misses_pool=max_misses_hash=0;
00450 max_mem_pool=max_mem_hash=0;
00451 pool_frags=0;
00452 for (i=0; i<SFM_POOLS_NO; i++){
00453 frags=0;
00454 misses=0;
00455 mem=0;
00456 for (r=0; r<SF_HASH_POOL_SIZE; r++){
00457 frags+=shm_block->pool[i].pool_hash[r].no;
00458 misses+=shm_block->pool[i].pool_hash[r].misses;
00459 mem+=shm_block->pool[i].pool_hash[r].no*r*SF_ROUNDTO;
00460 if (shm_block->pool[i].pool_hash[r].no>max_frags){
00461 max_frags=shm_block->pool[i].pool_hash[r].no;
00462 max_frags_pool=i;
00463 max_frags_hash=r;
00464 }
00465 if (shm_block->pool[i].pool_hash[r].misses>max_misses){
00466 max_misses=shm_block->pool[i].pool_hash[r].misses;
00467 max_misses_pool=i;
00468 max_misses_hash=r;
00469 }
00470 if (shm_block->pool[i].pool_hash[r].no*r*SF_ROUNDTO>max_mem){
00471 max_mem=shm_block->pool[i].pool_hash[r].no*r*SF_ROUNDTO;
00472 max_mem_pool=i;
00473 max_mem_hash=r;
00474 }
00475 }
00476 rpc->add(c, "{", &handle);
00477 rpc->struct_add(handle, "dddddd",
00478 "pool ", i,
00479 "frags ", (unsigned int)frags,
00480 "t. misses", (unsigned int)misses,
00481 "mem ", (unsigned int)mem,
00482 "missed", (unsigned int)shm_block->pool[i].missed,
00483 "hits", (unsigned int)shm_block->pool[i].hits
00484 );
00485 pool_frags+=frags;
00486 }
00487 main_s_frags=0;
00488 for (r=0; r<SF_HASH_POOL_SIZE; r++){
00489 main_s_frags+=shm_block->free_hash[r].no;
00490 }
00491 main_b_frags=0;
00492 for (; r<SF_HASH_SIZE; r++){
00493 main_b_frags+=shm_block->free_hash[r].no;
00494 }
00495 rpc->add(c, "{", &handle);
00496 rpc->struct_add(handle, "ddddddddddddd",
00497 "max_frags ", (unsigned int)max_frags,
00498 "max_frags_pool ", max_frags_pool,
00499 "max_frags_hash", max_frags_hash,
00500 "max_misses ", (unsigned int)max_misses,
00501 "max_misses_pool", max_misses_pool,
00502 "max_misses_hash", max_misses_hash,
00503 "max_mem ", (unsigned int)max_mem,
00504 "max_mem_pool ", max_mem_pool,
00505 "max_mem_hash ", max_mem_hash,
00506 "in_pools_frags ", (unsigned int)pool_frags,
00507 "main_s_frags ", (unsigned int)main_s_frags,
00508 "main_b_frags ", (unsigned int)main_b_frags,
00509 "main_frags ", (unsigned int)(main_b_frags+main_s_frags)
00510 );
00511 }
00512
00513
00514
00515 static const char* core_sfmalloc_doc[] = {
00516 "Returns sfmalloc debugging info.",
00517 0
00518 };
00519
00520 #endif
00521
00522
00523
00524 static const char* core_tcpinfo_doc[] = {
00525 "Returns tcp related info.",
00526 0
00527 };
00528
00529 static void core_tcpinfo(rpc_t* rpc, void* c)
00530 {
00531 #ifdef USE_TCP
00532 void *handle;
00533 struct tcp_gen_info ti;
00534
00535 if (!tcp_disable){
00536 tcp_get_info(&ti);
00537 rpc->add(c, "{", &handle);
00538 rpc->struct_add(handle, "dddd",
00539 "readers", ti.tcp_readers,
00540 "max_connections", ti.tcp_max_connections,
00541 "opened_connections", ti.tcp_connections_no,
00542 "write_queued_bytes", ti.tcp_write_queued
00543 );
00544 }else{
00545 rpc->fault(c, 500, "tcp support disabled");
00546 }
00547 #else
00548 rpc->fault(c, 500, "tcp support not compiled");
00549 #endif
00550 }
00551
00552
00553
00554 static const char* core_tcp_options_doc[] = {
00555 "Returns active tcp options.",
00556 0
00557 };
00558
00559 static void core_tcp_options(rpc_t* rpc, void* c)
00560 {
00561 #ifdef USE_TCP
00562 void *handle;
00563 struct cfg_group_tcp t;
00564
00565 if (!tcp_disable){
00566 tcp_options_get(&t);
00567 rpc->add(c, "{", &handle);
00568 rpc->struct_add(handle, "dddddddddddddddddddddd",
00569 "connect_timeout", t.connect_timeout_s,
00570 "send_timeout", TICKS_TO_S(t.send_timeout),
00571 "connection_lifetime", TICKS_TO_S(t.con_lifetime),
00572 "max_connections(soft)", t.max_connections,
00573 "no_connect", t.no_connect,
00574 "fd_cache", t.fd_cache,
00575 "async", t.async,
00576 "connect_wait", t.tcp_connect_wait,
00577 "conn_wq_max", t.tcpconn_wq_max,
00578 "wq_max", t.tcp_wq_max,
00579 "defer_accept", t.defer_accept,
00580 "delayed_ack", t.delayed_ack,
00581 "syncnt", t.syncnt,
00582 "linger2", t.linger2,
00583 "keepalive", t.keepalive,
00584 "keepidle", t.keepidle,
00585 "keepintvl", t.keepintvl,
00586 "keepcnt", t.keepcnt,
00587 "crlf_ping", t.crlf_ping,
00588 "accept_aliases", t.accept_aliases,
00589 "alias_flags", t.alias_flags,
00590 "new_conn_alias_flags", t.new_conn_alias_flags
00591 );
00592 }else{
00593 rpc->fault(c, 500, "tcp support disabled");
00594 }
00595 #else
00596 rpc->fault(c, 500, "tcp support not compiled");
00597 #endif
00598 }
00599
00600
00601
00602 static const char* core_sctp_options_doc[] = {
00603 "Returns active sctp options.",
00604 0
00605 };
00606
00607 static void core_sctp_options(rpc_t* rpc, void* c)
00608 {
00609 #ifdef USE_SCTP
00610 void *handle;
00611 struct cfg_group_sctp t;
00612
00613 if (!sctp_disable){
00614 sctp_options_get(&t);
00615 rpc->add(c, "{", &handle);
00616 rpc->struct_add(handle, "ddddddddddddddddddd",
00617 "sctp_socket_rcvbuf", t.so_rcvbuf,
00618 "sctp_socket_sndbuf", t.so_sndbuf,
00619 "sctp_autoclose", t.autoclose,
00620 "sctp_send_ttl", t.send_ttl,
00621 "sctp_send_retries", t.send_retries,
00622 "sctp_assoc_tracking", t.assoc_tracking,
00623 "sctp_assoc_reuse", t.assoc_reuse,
00624 "sctp_max_assocs", t.max_assocs,
00625 "sctp_srto_initial", t.srto_initial,
00626 "sctp_srto_max", t.srto_max,
00627 "sctp_srto_min", t.srto_min,
00628 "sctp_asocmaxrxt", t.asocmaxrxt,
00629 "sctp_init_max_attempts", t.init_max_attempts,
00630 "sctp_init_max_timeo",t.init_max_timeo,
00631 "sctp_hbinterval", t.hbinterval,
00632 "sctp_pathmaxrxt", t.pathmaxrxt,
00633 "sctp_sack_delay", t.sack_delay,
00634 "sctp_sack_freq", t.sack_freq,
00635 "sctp_max_burst", t.max_burst
00636 );
00637 }else{
00638 rpc->fault(c, 500, "sctp support disabled");
00639 }
00640 #else
00641 rpc->fault(c, 500, "sctp support not compiled");
00642 #endif
00643 }
00644
00645
00646
00647 static const char* core_sctpinfo_doc[] = {
00648 "Returns sctp related info.",
00649 0
00650 };
00651
00652 static void core_sctpinfo(rpc_t* rpc, void* c)
00653 {
00654 #ifdef USE_SCTP
00655 void *handle;
00656 struct sctp_gen_info i;
00657
00658 if (!sctp_disable){
00659 sctp_get_info(&i);
00660 rpc->add(c, "{", &handle);
00661 rpc->struct_add(handle, "ddd",
00662 "opened_connections", i.sctp_connections_no,
00663 "tracked_connections", i.sctp_tracked_no,
00664 "total_connections", i.sctp_total_connections
00665 );
00666 }else{
00667 rpc->fault(c, 500, "sctp support disabled");
00668 }
00669 #else
00670 rpc->fault(c, 500, "sctp support not compiled");
00671 #endif
00672 }
00673
00674
00675
00676
00677
00678
00679 rpc_export_t core_rpc_methods[] = {
00680 {"system.listMethods", system_listMethods, system_listMethods_doc, RET_ARRAY},
00681 {"system.methodSignature", system_methodSignature, system_methodSignature_doc, 0 },
00682 {"system.methodHelp", system_methodHelp, system_methodHelp_doc, 0 },
00683 {"core.prints", core_prints, core_prints_doc, 0 },
00684 {"core.version", core_version, core_version_doc, 0 },
00685 {"core.uptime", core_uptime, core_uptime_doc, 0 },
00686 {"core.ps", core_ps, core_ps_doc, RET_ARRAY},
00687 {"core.pwd", core_pwd, core_pwd_doc, RET_ARRAY},
00688 {"core.arg", core_arg, core_arg_doc, RET_ARRAY},
00689 {"core.kill", core_kill, core_kill_doc, 0 },
00690 {"core.shmmem", core_shmmem, core_shmmem_doc, 0 },
00691 #if defined(SF_MALLOC) || defined(LL_MALLOC)
00692 {"core.sfmalloc", core_sfmalloc, core_sfmalloc_doc, 0},
00693 #endif
00694 {"core.tcp_info", core_tcpinfo, core_tcpinfo_doc, 0},
00695 {"core.tcp_options", core_tcp_options, core_tcp_options_doc,0},
00696 {"core.sctp_options", core_sctp_options, core_sctp_options_doc,
00697 0},
00698 {"core.sctp_info", core_sctpinfo, core_sctpinfo_doc, 0},
00699 #ifdef USE_DNS_CACHE
00700 {"dns.mem_info", dns_cache_mem_info, dns_cache_mem_info_doc, 0 },
00701 {"dns.debug", dns_cache_debug, dns_cache_debug_doc, 0 },
00702 {"dns.debug_all", dns_cache_debug_all, dns_cache_debug_all_doc, 0 },
00703 {"dns.view", dns_cache_view, dns_cache_view_doc, 0 },
00704 {"dns.delete_all", dns_cache_delete_all, dns_cache_delete_all_doc, 0 },
00705 {"dns.add_a", dns_cache_add_a, dns_cache_add_a_doc, 0 },
00706 {"dns.add_aaaa", dns_cache_add_aaaa, dns_cache_add_aaaa_doc, 0 },
00707 {"dns.add_srv", dns_cache_add_srv, dns_cache_add_srv_doc, 0 },
00708 {"dns.delete_a", dns_cache_delete_a, dns_cache_delete_a_doc, 0 },
00709 {"dns.delete_aaaa", dns_cache_delete_aaaa, dns_cache_delete_aaaa_doc, 0 },
00710 {"dns.delete_srv", dns_cache_delete_srv, dns_cache_delete_srv_doc, 0 },
00711 #ifdef USE_DNS_CACHE_STATS
00712 {"dns.stats_get", dns_cache_stats_get, dns_cache_stats_get_doc, 0 },
00713 #endif
00714 #ifdef DNS_WATCHDOG_SUPPORT
00715 {"dns.set_server_state", dns_set_server_state_rpc, dns_set_server_state_doc, 0 },
00716 {"dns.get_server_state", dns_get_server_state_rpc, dns_get_server_state_doc, 0 },
00717 #endif
00718 #endif
00719 #ifdef USE_DST_BLACKLIST
00720 {"dst_blacklist.mem_info", dst_blst_mem_info, dst_blst_mem_info_doc, 0 },
00721 {"dst_blacklist.debug", dst_blst_debug, dst_blst_debug_doc, 0 },
00722 {"dst_blacklist.view", dst_blst_view, dst_blst_view_doc, 0 },
00723 {"dst_blacklist.delete_all", dst_blst_delete_all, dst_blst_delete_all_doc, 0 },
00724 {"dst_blacklist.add", dst_blst_add, dst_blst_add_doc, 0 },
00725 #ifdef USE_DST_BLACKLIST_STATS
00726 {"dst_blacklist.stats_get", dst_blst_stats_get, dst_blst_stats_get_doc, 0 },
00727 #endif
00728 #endif
00729 {0, 0, 0, 0}
00730 };
00731
00732 int rpc_init_time(void)
00733 {
00734 char *t;
00735 t=ctime(&up_since);
00736 if (strlen(t)+1>=MAX_CTIME_LEN) {
00737 ERR("Too long data %d\n", (int)strlen(t));
00738 return -1;
00739 }
00740 memcpy(up_since_ctime,t,strlen(t)+1);
00741 return 0;
00742 }