net/SocketDescriptor: add method GetPeerCredentials()

This commit is contained in:
Max Kellermann
2018-08-20 16:11:17 +02:00
parent 50c7337965
commit 0ebba73cb8
2 changed files with 40 additions and 0 deletions

View File

@@ -150,6 +150,20 @@ public:
int GetError();
/**
* @return the value size or 0 on error
*/
size_t GetOption(int level, int name, void *value, size_t size) const;
#ifdef HAVE_STRUCT_UCRED
/**
* Receive peer credentials (SO_PEERCRED). On error, the pid
* is -1.
*/
gcc_pure
struct ucred GetPeerCredentials() const noexcept;
#endif
bool SetOption(int level, int name, const void *value, size_t size);
bool SetBoolOption(int level, int name, bool _value) {