X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=dccp_send.c;h=94719f0443c2081842c14e6e153262e551e2903c;hp=d2f81dd9168023df27a1fefdb883e3234382c1cc;hb=e9e826f4fb415c4225ff5934fe42572ffa3b5ebc;hpb=fb62100d23baea388cec78e572b0f36d051a61c0 diff --git a/dccp_send.c b/dccp_send.c index d2f81dd9..94719f04 100644 --- a/dccp_send.c +++ b/dccp_send.c @@ -104,9 +104,33 @@ static int dccp_com_allow(struct sender_command_data *scd) return 1; } +/** + * Return list of available CCIDs or warning, in static buffer. + */ +static const char *dccp_list_available_ccids(void) +{ + uint8_t ccids[DCCP_MAX_HOST_CCIDS]; + uint8_t nccids = sizeof(ccids), i, len; + /* Worst case length: n * 3 digits + n-1 spaces + '\0' */ + static char list[DCCP_MAX_HOST_CCIDS * 4]; + + if (dccp_available_ccids(ccids, &nccids) == NULL) { + 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_info(void) { - return get_sender_info(dss, "dccp"); + char *info = get_sender_info(dss, "dccp"); + char *ret = make_message("%s" "\tsupported ccids: %s\n", + info, dccp_list_available_ccids()); + free(info); + return ret; } /**