static void printverboseheader(int sockfd) { client_printf(sockfd, "Keys:\n"); client_printf(sockfd, "%-31s %-8s %-9s %-24s %-5s %-10s %-32s %-11s %s\n", "Zone:", "Keytype:", "State:", "Date of next transition:", "Size:", "Algorithm:", "CKA_ID:", "Repository:", "KeyTag:"); }
static int run(int sockfd, cmdhandler_ctx_type* context, const char *cmd) { const char *fmt = "%-31s %-48s\n"; policy_list_t *pol_list; const policy_t *policy; db_connection_t* dbconn = getconnectioncontext(context);; engine_type* engine = getglobalcontext(context); (void)cmd; if (!(pol_list = policy_list_new_get(dbconn))) return 1; /* May want to keep this for compatibility? * client_printf(sockfd, "Database set to: %s\nPolicies:\n", engine->config->datastore);*/ client_printf(sockfd, fmt, "Policy:", "Description:"); policy = policy_list_next(pol_list); while (policy) { client_printf(sockfd, fmt, policy_name(policy), policy_description(policy)); policy = policy_list_next(pol_list); } policy_list_free(pol_list); return 0; }
static void print_playlist_in_directory(struct client *client, const struct directory *directory, const char *name_utf8) { if (directory_is_root(directory)) client_printf(client, "playlist: %s\n", name_utf8); else client_printf(client, "playlist: %s/%s\n", directory_get_path(directory), name_utf8); }
void tag_print(struct client *client, const struct tag *tag) { if (tag->time >= 0) client_printf(client, SONG_TIME "%i\n", tag->time); for (unsigned i = 0; i < tag->num_items; i++) { client_printf(client, "%s: %s\n", tag_item_names[tag->items[i]->type], tag->items[i]->value); } }
/** * Send detailed information about a range of songs in the queue to a * client. * * @param client the client which has requested information * @param start the index of the first song (including) * @param end the index of the last song (excluding) */ static void queue_print_song_info(struct client *client, const struct queue *queue, unsigned position) { song_print_info(client, queue_get(queue, position)); client_printf(client, "Pos: %u\nId: %u\n", position, queue_position_to_id(queue, position)); uint8_t priority = queue_get_priority_at_position(queue, position); if (priority != 0) client_printf(client, "Prio: %u\n", priority); }
static void printdebugheader(int sockfd) { client_printf(sockfd, "Keys:\nZone: Key role: " "DS: DNSKEY: RRSIGDNSKEY: RRSIG: " "Pub: Act: Id:\n"); }
static void help(int sockfd) { client_printf(sockfd, "Export list of zones from the database to the zonelist.xml file.\n\n" ); }
static bool print_visitor_playlist_info(const struct playlist_metadata *playlist, const struct directory *directory, void *ctx, G_GNUC_UNUSED GError **error_r) { struct client *client = ctx; print_playlist_in_directory(client, directory, playlist->name); #ifndef G_OS_WIN32 struct tm tm; #endif char timestamp[32]; time_t t = playlist->mtime; strftime(timestamp, sizeof(timestamp), #ifdef G_OS_WIN32 "%Y-%m-%dT%H:%M:%SZ", gmtime(&t) #else "%FT%TZ", gmtime_r(&t, &tm) #endif ); client_printf(client, "Last-Modified: %s\n", timestamp); return true; }
static void help(int sockfd) { client_printf(sockfd, "Force write of signer configuration files for all zones.\n\n" ); }
static int run(int sockfd, cmdhandler_ctx_type* context, const char *cmd) { db_connection_t* dbconn = getconnectioncontext(context); engine_type* engine = getglobalcontext(context); (void)cmd; if (!engine) { return 1; } if (!engine->config) { return 1; } if (!engine->config->zonelist_filename) { return 1; } if (!dbconn) { return 1; } ods_log_debug("[%s] %s command", module_str, zonelist_export_funcblock.cmdname); if (zonelist_export(sockfd, dbconn, engine->config->zonelist_filename, 1) != ZONELIST_EXPORT_OK) { ods_log_error("[%s] zonelist exported to %s failed", module_str, engine->config->zonelist_filename); client_printf_err(sockfd, "Exported zonelist to %s failed!\n", engine->config->zonelist_filename); return 1; } ods_log_info("[%s] zonelist exported to %s successfully", module_str, engine->config->zonelist_filename); client_printf(sockfd, "Exported zonelist to %s successfully\n", engine->config->zonelist_filename); return 0; }
static void enf_schedule_task(int sockfd, engine_type* engine, task_type *task, const char *what) { /* schedule task */ if (!task) { ods_log_crit("[%s] failed to create %s task", module_str, what); } else { ods_status status = schedule_task(engine->taskq, task); if (status != ODS_STATUS_OK) { ods_log_crit("[%s] failed to create %s task", module_str, what); client_printf(sockfd, "Unable to schedule %s task.\n", what); } else { client_printf(sockfd, "Scheduled %s task.\n", what); } } }
static void usage(int sockfd) { client_printf(sockfd, "zonelist export\n" ); }
static void help(int sockfd) { client_printf(sockfd, "List all policies in the database.\n\n" ); }
static void usage(int sockfd) { client_printf(sockfd, "queue\n" ); }
static void usage_flush(int sockfd) { client_printf(sockfd, "flush\n" ); }
int listAllUniqueTags(struct client *client, int type, const struct locate_item_list *criteria) { int ret; ListCommandItem *item = newListCommandItem(type, criteria); struct list_tags_data data = { .client = client, .item = item, }; if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) { data.set = strset_new(); } ret = db_walk(NULL, listUniqueTagsInDirectory, NULL, &data); if (type >= 0 && type <= TAG_NUM_OF_ITEM_TYPES) { const char *value; strset_rewind(data.set); while ((value = strset_next(data.set)) != NULL) client_printf(client, "%s: %s\n", tag_item_names[type], value); strset_free(data.set); } freeListCommandItem(item); return ret; }
static void usage(int sockfd) { client_printf(sockfd, "signconf\n" ); }
static void usage(int sockfd) { client_printf(sockfd, "rollover list\n" " [--zone <zone>] aka -z\n" ); }
void song_print_info(struct client *client, struct song *song) { song_print_uri(client, song); if (song->end_ms > 0) client_printf(client, "Range: %u.%03u-%u.%03u\n", song->start_ms / 1000, song->start_ms % 1000, song->end_ms / 1000, song->end_ms % 1000); else if (song->start_ms > 0) client_printf(client, "Range: %u.%03u-\n", song->start_ms / 1000, song->start_ms % 1000); if (song->mtime > 0) { #ifndef G_OS_WIN32 struct tm tm; #endif const struct tm *tm2; #ifdef G_OS_WIN32 tm2 = gmtime(&song->mtime); #else tm2 = gmtime_r(&song->mtime, &tm); #endif if (tm2 != NULL) { char timestamp[32]; strftime(timestamp, sizeof(timestamp), #ifdef G_OS_WIN32 "%Y-%m-%dT%H:%M:%SZ", #else "%FT%TZ", #endif tm2); client_printf(client, "Last-Modified: %s\n", timestamp); } } if (song->tag) tag_print(client, song->tag); }
static void help(int sockfd) { client_printf(sockfd, "List the expected dates and times of upcoming rollovers. This can be used to get an idea of upcoming works.\n" "\nOptions:\n" "zone name of the zone\n\n"); }
void queue_print_changes_position(struct client *client, const struct queue *queue, uint32_t version) { for (unsigned i = 0; i < queue_length(queue); i++) if (queue_song_newer(queue, i, version)) client_printf(client, "cpos: %i\nId: %i\n", i, queue_position_to_id(queue, i)); }
static void help(int sockfd) { client_printf(sockfd, "queue shows all scheduled tasks with their time of earliest executions,\n" "as well as all tasks currently being processed." "\n\n" ); }
void print_supported_uri_schemes(struct client *client) { const char **prefixes = remoteUrlPrefixes; while (*prefixes) { client_printf(client, "handler: %s\n", *prefixes); prefixes++; } }
static void usage(int sockfd) { client_printf(sockfd, "zone delete\n" " --zone <zone> | --all aka -z | -a \n" " [--xml] aka -u \n" ); }
static void decoder_plugin_print(struct client *client, const struct decoder_plugin *plugin) { const char *const*p; assert(plugin != NULL); assert(plugin->name != NULL); client_printf(client, "plugin: %s\n", plugin->name); if (plugin->suffixes != NULL) for (p = plugin->suffixes; *p != NULL; ++p) client_printf(client, "suffix: %s\n", *p); if (plugin->mime_types != NULL) for (p = plugin->mime_types; *p != NULL; ++p) client_printf(client, "mime_type: %s\n", *p); }
static void help(int sockfd) { client_printf(sockfd, "Issue a ds-submit to the enforcer for a KSK.\n" "(This command with no parameters lists eligible keys.)\n" "\nOptions:\n" "zone name of the zone\n" "keytag|cka_id specify the key tag or the locator of the key\n\n"); }
void tag_print_types(struct client *client) { int i; for (i = 0; i < TAG_NUM_OF_ITEM_TYPES; i++) { if (!ignore_tag_items[i]) client_printf(client, "tagtype: %s\n", tag_item_names[i]); } }
static void help(int sockfd) { client_printf(sockfd, "Delete one zone or all of them from the enforcer database.\n" "\nOptions:\n" "zone|all name of the zone or all zones\n" "xml update zonelist.xml and remove the contents for the deleted zone\n\n" ); }
void song_print_url(struct client *client, struct song *song) { if (song_in_database(song) && !directory_is_root(song->parent)) { client_printf(client, "%s%s/%s\n", SONG_FILE, directory_get_path(song->parent), song->url); } else { char *allocated; const char *uri; uri = allocated = uri_remove_auth(song->url); if (uri == NULL) uri = song->url; client_printf(client, "%s%s\n", SONG_FILE, uri); g_free(allocated); } }
static int printDirectoryInDirectory(struct directory *directory, void *data) { struct client *client = data; if (!directory_is_root(directory)) client_printf(client, "directory: %s\n", directory_get_path(directory)); return 0; }