added basic ssl support to ircu
[ircu2.10.12-pk.git] / include / jupe.h
index 5c0cf7a9e87cd8144b5e7fd58da6a4801d2536fe..47da2ed7b1ddc6e706371bfa44788dfd1802a138 100644 (file)
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
  */
-#ifndef INCLUDED_config_h
-#include "config.h"
-#endif
+/** @file
+ * @brief  Interface and declarations for juped server handling.
+ * @version $Id$
+ */
 #ifndef INCLUDED_sys_types_h
 #include <sys/types.h>
 #define INCLUDED_sys_types_h
 
 struct Client;
 
-#define JUPE_MAX_EXPIRE        604800  /* max expire: 7 days */
+#define JUPE_MAX_EXPIRE        604800  /**< Maximum jupe expiration time (7 days). */
 
+/** Describes a juped server.
+ * A hub will not accept new connections from a juped server.
+ */
 struct Jupe {
-  struct Jupe*   ju_next;
-  struct Jupe**  ju_prev_p;
-  char*          ju_server;
-  char*          ju_reason;
-  time_t         ju_expire;
-  time_t         ju_lastmod;
-  unsigned int   ju_flags;
+  struct Jupe*   ju_next;    /**< Pointer to next Jupe. */
+  struct Jupe**  ju_prev_p;  /**< Pointer to previous next pointer. */
+  char*          ju_server;  /**< Name of server to jupe. */
+  char*          ju_reason;  /**< Reason for the jupe. */
+  time_t         ju_expire;  /**< Expiration time of the jupe. */
+  time_t         ju_lastmod; /**< Last modification time (if any) for the jupe. */
+  unsigned int   ju_flags;   /**< Status flags for the jupe. */
 };
 
-#define JUPE_ACTIVE    1
-#define JUPE_LOCAL     2
+#define JUPE_ACTIVE    0x0001  /**< Jupe is globally active. */
+#define JUPE_LOCAL     0x0002  /**< Jupe only applies to this server. */
+#define JUPE_LDEACT    0x0004  /**< Jupe is locally deactivated */
+
+#define JUPE_MASK      (JUPE_ACTIVE | JUPE_LOCAL)
+#define JUPE_ACTMASK   (JUPE_ACTIVE | JUPE_LDEACT)
 
-#define JupeIsActive(j)                ((j)->ju_flags & JUPE_ACTIVE)
+/** Test whether \a j is active. */
+#define JupeIsActive(j)                (((j)->ju_flags & JUPE_ACTMASK) == JUPE_ACTIVE)
+/** Test whether \a j is globally (remotely) active. */
+#define JupeIsRemActive(j)     ((j)->ju_flags & JUPE_ACTIVE)
+/** Test whether \a j is local. */
 #define JupeIsLocal(j)         ((j)->ju_flags & JUPE_LOCAL)
 
+/** Get the server name for \a j. */
 #define JupeServer(j)          ((j)->ju_server)
+/** Get the reason fro \a j. */
 #define JupeReason(j)          ((j)->ju_reason)
+/** Get the last modification time for \a j. */
 #define JupeLastMod(j)         ((j)->ju_lastmod)
 
 extern int jupe_add(struct Client *cptr, struct Client *sptr, char *server,
-                   char *reason, time_t expire, time_t lastmod, int local,
-                   int active);
+                   char *reason, time_t expire, time_t lastmod,
+                   unsigned int flags);
 extern int jupe_activate(struct Client *cptr, struct Client *sptr,
-                        struct Jupe *jupe, time_t lastmod);
+                        struct Jupe *jupe, time_t lastmod,
+                        unsigned int flags);
 extern int jupe_deactivate(struct Client *cptr, struct Client *sptr,
-                          struct Jupe *jupe, time_t lastmod);
+                          struct Jupe *jupe, time_t lastmod,
+                          unsigned int flags);
 extern struct Jupe* jupe_find(char *server);
 extern void jupe_free(struct Jupe *jupe);
 extern void jupe_burst(struct Client *cptr);
 extern int jupe_resend(struct Client *cptr, struct Jupe *jupe);
 extern int jupe_list(struct Client *sptr, char *server);
+extern int jupe_memory_count(size_t *ju_size);
 
 #endif /* INCLUDED_jupe_h */