added basic ssl support to ircu
[ircu2.10.12-pk.git] / include / s_bsd.h
index 581df926f25ce6d5905ca4230de6b444902a28f1..acb24b7c6828b12855e35930cf2bfa6e22f21fe9 100644 (file)
@@ -1,22 +1,23 @@
-/*
- * s_bsd.h
- *
- * $Id$
+/** @file s_bsd.h
+ * @brief Wrapper functions to avoid direct use of BSD APIs.
+ * @version $Id$
  */
 #ifndef INCLUDED_s_bsd_h
 #define INCLUDED_s_bsd_h
-#ifndef INCLUDED_config_h
-#include "config.h"
-#endif
 #ifndef INCLUDED_sys_types_h
 #include <sys/types.h>         /* size_t, time_t */
 #define INCLUDED_sys_types_h
 #endif
+#ifndef INCLUDED_netinet_in_h
+#include <netinet/in.h>
+#define INCLUDED_netinet_in_h
+#endif
 
 struct Client;
 struct ConfItem;
 struct Listener;
-struct DNSReply;
+struct MsgQ;
+struct irc_in_addr;
 
 /*
  * TCP window sizes
@@ -24,7 +25,9 @@ struct DNSReply;
  * set client to a smaller size to allow TCP flow control
  * to reduce flooding
  */
+/** Default TCP window size for server connections. */
 #define SERVER_TCP_WINDOW 61440
+/** Default TCP window size for client connections. */
 #define CLIENT_TCP_WINDOW 2048
 
 extern void report_error(const char* text, const char* who, int err);
@@ -43,46 +46,29 @@ extern const char* const POLL_ERROR_MSG;
 extern const char* const SELECT_ERROR_MSG;
 extern const char* const CONNECT_ERROR_MSG;
 extern const char* const SETBUFS_ERROR_MSG;
-
+extern const char* const TOS_ERROR_MSG;
+extern const char* const REGISTER_ERROR_MSG;
 
 extern int            HighestFd;
 extern struct Client* LocalClientArray[MAXCONNECTIONS];
-extern int            OpenFileDescriptorCount;
-
-extern struct sockaddr_in VirtualHost;
-
-enum PollType {
-  PT_NONE,
-  PT_READ,
-  PT_WRITE
-};
-
-struct Pollable;
-
-typedef int (*PollReadyFn)(struct Pollable*);
+extern struct irc_sockaddr VirtualHost_v4;
+extern struct irc_sockaddr VirtualHost_v6;
+extern struct irc_sockaddr VirtualHost_dns_v4;
+extern struct irc_sockaddr VirtualHost_dns_v6;
 
-struct Pollable {
-  struct Pollable* next;
-  struct Pollable* prev;
-  int              fd;
-  int              index;
-  int              state;
-  PollReadyFn      r_handler;
-  PollReadyFn      w_handler;
-};
-  
 /*
  * Proto types
  */
-extern unsigned int deliver_it(struct Client *cptr, const char *str, unsigned int len);
-extern int connect_server(struct ConfItem* aconf, struct Client* by,
-                          struct DNSReply* reply);
-extern void release_dns_reply(struct Client* cptr);
+extern int completed_connection(struct Client* cptr);
+extern unsigned int deliver_it(struct Client *cptr, struct MsgQ *buf);
+extern int connect_server(struct ConfItem* aconf, struct Client* by);
 extern int  net_close_unregistered_connections(struct Client* source);
-extern void init_sys(void);
 extern void close_connection(struct Client *cptr);
 extern void add_connection(struct Listener* listener, int fd);
 extern int  read_message(time_t delay);
-extern int init_server_identity(void);
+extern void init_server_identity(void);
+extern void close_connections(int close_stderr);
+extern int  init_connection_limits(void);
+extern void update_write(struct Client* cptr);
 
 #endif /* INCLUDED_s_bsd_h */