Skip to content

Commit

Permalink
cleanup(sinsp): add some inline and const
Browse files Browse the repository at this point in the history
Signed-off-by: Andrea Terzolo <[email protected]>
  • Loading branch information
Andreagit97 authored and poiana committed Dec 18, 2023
1 parent e4585f2 commit e6db0e6
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions userspace/libsinsp/fdinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -164,71 +164,71 @@ class SINSP_PUBLIC sinsp_fdinfo
/*!
\brief Returns true if this is a unix socket.
*/
bool is_unix_socket()
inline bool is_unix_socket() const
{
return m_type == SCAP_FD_UNIX_SOCK;
}

/*!
\brief Returns true if this is an IPv4 socket.
*/
bool is_ipv4_socket()
inline bool is_ipv4_socket() const
{
return m_type == SCAP_FD_IPV4_SOCK;
}

/*!
\brief Returns true if this is an IPv4 socket.
*/
bool is_ipv6_socket()
inline bool is_ipv6_socket() const
{
return m_type == SCAP_FD_IPV6_SOCK;
}

/*!
\brief Returns true if this is a UDP socket.
*/
bool is_udp_socket()
inline bool is_udp_socket() const
{
return m_type == SCAP_FD_IPV4_SOCK && m_sockinfo.m_ipv4info.m_fields.m_l4proto == SCAP_L4_UDP;
}

/*!
\brief Returns true if this is a unix TCP.
*/
bool is_tcp_socket()
inline bool is_tcp_socket() const
{
return m_type == SCAP_FD_IPV4_SOCK && m_sockinfo.m_ipv4info.m_fields.m_l4proto == SCAP_L4_TCP;
}

/*!
\brief Returns true if this is a pipe.
*/
bool is_pipe()
inline bool is_pipe() const
{
return m_type == SCAP_FD_FIFO;
}

/*!
\brief Returns true if this is a file.
*/
bool is_file()
inline bool is_file() const
{
return m_type == SCAP_FD_FILE || m_type == SCAP_FD_FILE_V2;
}

/*!
\brief Returns true if this is a directory.
*/
bool is_directory()
inline bool is_directory() const
{
return m_type == SCAP_FD_DIRECTORY;
}

/*!
\brief Returns true if this is a pidfd, created through pidfd_open.
*/
bool is_pidfd()
inline bool is_pidfd() const
{
return m_type == SCAP_FD_PIDFD;
}
Expand Down

0 comments on commit e6db0e6

Please sign in to comment.