summaryrefslogtreecommitdiff
path: root/Libraries/LibC/netdb.h
diff options
context:
space:
mode:
authorRead H <hughes.read@gmail.com>2020-04-16 13:37:06 -0400
committerAndreas Kling <kling@serenityos.org>2020-04-18 10:11:55 +0200
commitee5816b9c8d1da8f0e01eaaddb6e73150dfa827f (patch)
tree59ffcf7a9c299722d4d3b520d2bddbcfe8bdd340 /Libraries/LibC/netdb.h
parent0ef2efac7c840e45ca3534a7b355ba16b90929a9 (diff)
downloadserenity-ee5816b9c8d1da8f0e01eaaddb6e73150dfa827f.zip
LibC: getprotoent() family of functions
This commit implements the getprotoent() family of functions, including getprotoent() getprotobyname() getprotobynumber() setprotoent() endprotoent() This implementation is very similar to the getservent family of functions, which is what led to the discovery of a bug in the process of reading the aliases. The ByteBuffer for the alias strings didn't include a null terminating character, this was fixed for both the protoent and servent family of functions by appending a null character to the end of them before adding them to the alias lists.
Diffstat (limited to 'Libraries/LibC/netdb.h')
-rw-r--r--Libraries/LibC/netdb.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/Libraries/LibC/netdb.h b/Libraries/LibC/netdb.h
index 802c89a39d..c2bd5a130f 100644
--- a/Libraries/LibC/netdb.h
+++ b/Libraries/LibC/netdb.h
@@ -55,6 +55,19 @@ struct servent* getservbyname(const char* name, const char* protocol);
struct servent* getservbyport(int port, const char* protocol);
void setservent(int stay_open);
void endservent();
+
+struct protoent {
+ char* p_name;
+ char** p_aliases;
+ int p_proto;
+};
+
+void endprotoent();
+struct protoent* getprotobyname(const char* name);
+struct protoent* getprotobynumber(int proto);
+struct protoent* getprotoent();
+void setprotoent(int stay_open);
+
extern int h_errno;
#define HOST_NOT_FOUND 101