- int ret;
-
- INIT_LIST_HEAD(&clients);
- s->info = dccp_info;
- s->send = dccp_send;
- s->pre_select = dccp_pre_select;
- s->post_select = dccp_post_select;
- s->shutdown_clients = dccp_shutdown_clients;
- s->help = dccp_help;
- s->client_cmds[SENDER_ON] = NULL;
- s->client_cmds[SENDER_OFF] = NULL;
- s->client_cmds[SENDER_DENY] = NULL;
- s->client_cmds[SENDER_ALLOW] = NULL;
- s->client_cmds[SENDER_ADD] = NULL;
- s->client_cmds[SENDER_DELETE] = NULL;
- self = s;
- ret = dccp_open();
- if (ret < 0) {
- PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret));
- s->status = SENDER_OFF;
- } else
- s->status = SENDER_ON;
+ /* Worst case length: n * 3 digits + n-1 spaces + '\0' */
+ static char list[DCCP_MAX_HOST_CCIDS * 4];
+ uint8_t *ccids;
+ int i, len, nccids;
+
+ nccids = dccp_available_ccids(&ccids);
+ if (nccids < 0) {
+ snprintf(list, sizeof(list), "Unable to query available CCIDs");
+ } else {
+ for (i = len = 0; i < nccids; i++)
+ len += snprintf(list + len, sizeof(list) - len,
+ "%s%d", i ? " " : "", ccids[i]);
+ }
+ return list;
+}
+
+static char *dccp_status(void)
+{
+ char *status = generic_sender_status(dss, "dccp");
+ char *result = make_message("%ssupported ccids: %s\n", status,
+ dccp_list_available_ccids());
+ free(status);
+ return result;
+}
+
+/*
+ * Initialize the client list and the access control list and listen on the
+ * dccp port.
+ */
+static void dccp_send_init(void)
+{
+ init_sender_status(dss, OPT_RESULT(DCCP_ACCESS),
+ OPT_RESULT(DCCP_LISTEN_ADDRESS),
+ OPT_UINT32_VAL(DCCP_PORT), OPT_UINT32_VAL(DCCP_MAX_CLIENTS),
+ OPT_GIVEN(DCCP_DEFAULT_DENY));
+ generic_com_on(dss, IPPROTO_DCCP);