return new_fd < 0? -ERRNO_TO_PARA_ERROR(errno) : new_fd;
}
+/**
+ * Probe the list of DCCP CCIDs supported locally by the host.
+ * \param ccids Array to be filled in.
+ * \param nccids Length of \a ccids.
+ * \return Pointer to \a ccids, NULL on failure.
+ *
+ * NB: This feature is only available on Linux > 2.6.30; on older kernels
+ * ENOPROTOOPT ("Protocol not available") will be returned.
+ */
+const uint8_t *dccp_available_ccids(uint8_t *ccids, uint8_t *nccids)
+{
+ int fd = makesock(AF_UNSPEC, IPPROTO_DCCP, 0, NULL, 0);
+
+ if (fd < 0)
+ return NULL;
+
+ if (getsockopt(fd, SOL_DCCP, DCCP_SOCKOPT_AVAILABLE_CCIDS,
+ ccids, (socklen_t *)nccids) < 0) {
+ PARA_ERROR_LOG("No DCCP_SOCKOPT_AVAILABLE_CCIDS: %s\n",
+ strerror(errno));
+ *nccids = 0;
+ }
+ close(fd);
+
+ return *nccids ? ccids : NULL;
+}
+
/**
* Prepare a structure for \p AF_UNIX socket addresses.
*