#include "../log.h"
#include "../qman.h"
#include <glue.h>
#include <demi/libos.h>
#include <errno.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
int __setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen)
{
int ret;
if (!queue_man_query_fd(sockfd))
{
errno = EBADF;
return -1;
}
TRACE("sockfd=%d, level=%d, optname=%d, optval=%p, optlen=%d", sockfd, level, optname, optval, 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_setsockopt(sockfd, level, optname, optval, optlen);
return (ret);
}