/**
 * Returns the path of the memory-file corresponding to a server and a multicast
 * group.
 *
 * @param[in] servAddr  The address of the server associated with the multicast
 *                      group.
 * @param[in] feedtype  Feedtype of multicast group.
 * @retval    NULL      Failure. `log_start()` called.
 * @return              The path of the corresponding memory-file. The caller
 *                      should free when it's no longer needed.
 */
static char*
getSessionPath(
    const ServiceAddr* const servAddr,
    const feedtypet          feedtype)
{
    char*       path;
    char* const servAddrStr = sa_format(servAddr);

    if (servAddrStr) {
        path = ldm_format(256, "%s/%s_%s.yaml", getLdmLogDir(), servAddrStr,
                s_feedtypet(feedtype));
        free(servAddrStr);
    }

    return path;
}
示例#2
0
/**
 * Returns the pathname of the memory-file corresponding to a server and a
 * multicast group. This function is reentrant.
 *
 * @param[in] servAddr  The address of the server associated with the multicast
 *                      group.
 * @param[in] feedtype  Feedtype of multicast group.
 * @retval    NULL      Failure. `log_start()` called.
 * @return              The path of the corresponding memory-file. The caller
 *                      should free when it's no longer needed.
 */
static char*
getSessionPath(
    const ServiceAddr* const servAddr,
    const feedtypet          feedtype)
{
    char* path;
    char  ftBuf[256];

    if (sprint_feedtypet(ftBuf, sizeof(ftBuf), feedtype) < 0) {
        LOG_START0("sprint_feedtypet() failure");
        path = NULL;
    }
    else {
        path = ldm_format(256, "%s/%s_%s.yaml", getLdmLogDir(),
                servAddr->inetId, ftBuf);
    }

    return path;
}