#include "../error.h"
#include "../log.h"
#include "../qman.h"
#include "../utils.h"
#include <glue.h>
#include <demi/libos.h>
#include <errno.h>
#include <netinet/tcp.h>
#include <sys/socket.h>
int __getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen)
{
int ret = -1;
if (!queue_man_query_fd(sockfd))
{
errno = EBADF;
return -1;
}
TRACE("sockfd=%d, level=%d, optname=%d, optval=%p, optlen=%p", sockfd, level, optname, optval, (void *)optlen);
if (level == SOL_SOCKET && optname == SO_REUSEADDR)
{
WARN("%s is not supported", "SO_REUSEADDR");
}
else if (level == IPPROTO_TCP && optname == TCP_KEEPIDLE)
{
WARN("%s is not supported", "TCP_KEEPIDLE");
}
else if (level == IPPROTO_TCP && optname == TCP_KEEPINTVL)
{
WARN("%s is not supported", "TCP_KEEPINTLVL");
}
else if (level == IPPROTO_TCP && optname == TCP_KEEPCNT)
{
WARN("%s is not supported", "TCP_KEEPCNT");
}
else if (level == IPPROTO_TCP && optname == TCP_ULP)
{
WARN("%s is not supported", "TCP_ULP");
}
ret = __demi_getsockopt(sockfd, level, optname, optval, optlen);
if (ret != 0)
{
errno = ret;
return -1;
}
return (ret);
}