Usermode/libpsocket - Features used by irssi
authorJohn Hodge <[email protected]>
Fri, 29 Nov 2013 14:06:56 +0000 (22:06 +0800)
committerJohn Hodge <[email protected]>
Fri, 29 Nov 2013 14:06:56 +0000 (22:06 +0800)
Usermode/Libraries/libpsocket.so_src/include_exp/netdb.h
Usermode/Libraries/libpsocket.so_src/include_exp/netinet/in.h
Usermode/Libraries/libpsocket.so_src/include_exp/sys/socket.h

index d0f12b9..95f6f2e 100644 (file)
@@ -3,6 +3,38 @@
 
 #include <sys/socket.h>
 
+struct hostent
+{
+       char    *h_name;
+       char    **h_aliases;
+        int    h_addrtype;
+        int    h_length;
+       char    **h_addr_list;
+};
+
+struct netent
+{
+       char    *n_name;
+       char    **n_aliases;
+       int     n_addrtype;
+       uint32_t        n_net;
+};
+
+struct protoent
+{
+       char    *p_name;
+       char    **p_aliases;
+        int    p_proto;
+};
+
+struct servent
+{
+       char    *s_name;
+       char    **s_aliases;
+       int     s_port;
+       char    *s_proto;
+};
+
 #define AI_PASSIVE     0x001
 #define AI_V4MAPPED    0x002
 #define AI_ADDRCONFIG  0x004
 #define        NI_NUMERICHOST  (1<<3)
 #define NI_NUMERICSERV (1<<4)
 
+#define NI_MAXHOST     1024    // may not be posix
+
+// Error values from gethostbyaddr/gethostbyname
+enum
+{
+       HOST_NOT_FOUND = 1,
+       NO_DATA,
+       NO_RECOVERY,
+       TRY_AGAIN,
+};
+
 enum
 {
        EAI_SUCCESS,
@@ -50,6 +93,12 @@ extern int   getaddrinfo(const char *node, const char *service, const struct addri
 extern void    freeaddrinfo(struct addrinfo *res);
 const char     *gai_strerror(int errorcode);
 
+extern struct servent  *getservbyname(const char *name, const char *proto);
+extern struct servent  *getservbyport(int port, const char *proto);
+
+extern void    setservent(int stayopen);
+extern struct servent  *getservent(void);
+extern void    enservent(void);
 
 #endif
 
index 94655e1..d69ce86 100644 (file)
@@ -39,11 +39,16 @@ enum {
        IPPROTO_UDP
 };
 
+#define INET_ADDRSTRLEN        16
+#define INET6_ADDRSTRLEN       48      // linux
+
 struct in6_addr
 {
        unsigned char   s6_addr[16];
 };
 
+extern struct in6_addr in6addr_any;
+
 struct sockaddr_in6
 {
        sa_family_t     sin6_family;
index 4d052db..18c40e7 100644 (file)
@@ -96,7 +96,8 @@ enum
 {
        SO_REUSEADDR,
        SO_LINGER,
-       SO_ERROR
+       SO_ERROR,
+       SO_KEEPALIVE,
 };
 
 // shutdown how

UCC git Repository :: git.ucc.asn.au