parse.h 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * ngIRCd -- The Next Generation IRC Daemon
  3. * Copyright (c)2001,2002 by Alexander Barton (alex@barton.de)
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. * Please read the file COPYING, README and AUTHORS for more information.
  10. */
  11. #ifndef __parse_h__
  12. #define __parse_h__
  13. /**
  14. * @file
  15. * IRC command parser and validator (header)
  16. */
  17. #include "portab.h"
  18. /** A single IRC request ("command"). See RFC 2812 section 2.3 for details. */
  19. typedef struct _REQUEST
  20. {
  21. char *prefix; /**< Prefix */
  22. char *command; /**< IRC command */
  23. char *argv[15]; /**< Parameters, at most 15 (0..14) */
  24. int argc; /**< Number of given paramaters */
  25. } REQUEST;
  26. /** IRC command handling structure */
  27. typedef struct _COMMAND
  28. {
  29. const char *name; /**< Command name */
  30. bool (*function) PARAMS(( CLIENT *Client, REQUEST *Request ));
  31. /**< Function to handle this command */
  32. CLIENT_TYPE type; /**< Valid client types (bit mask) */
  33. long lcount, rcount; /**< Number of local and remote calls */
  34. long bytes; /**< Number of bytes created */
  35. } COMMAND;
  36. GLOBAL bool Parse_Request PARAMS((CONN_ID Idx, char *Request ));
  37. GLOBAL COMMAND *Parse_GetCommandStruct PARAMS(( void ));
  38. #endif
  39. /* -eof- */