fifo_server.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * $Id$
  3. *
  4. *
  5. * Copyright (C) 2001-2003 Fhg Fokus
  6. *
  7. * This file is part of ser, a free SIP server.
  8. *
  9. * ser is free software; you can redistribute it and/or modify
  10. * it under the terms of the GNU General Public License as published by
  11. * the Free Software Foundation; either version 2 of the License, or
  12. * (at your option) any later version
  13. *
  14. * For a license to use the ser software under conditions
  15. * other than those described here, or to purchase support for this
  16. * software, please contact iptel.org by e-mail at the following addresses:
  17. * [email protected]
  18. *
  19. * ser is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  27. */
  28. #ifndef _FIFO_SERVER_H
  29. #define _FIFO_SERVER_H
  30. #include <stdio.h>
  31. #define CMD_SEPARATOR ':'
  32. /* core FIFO command set */
  33. /* echo input */
  34. #define FIFO_PRINT "print"
  35. /* print server's uptime */
  36. #define FIFO_UPTIME "uptime"
  37. /* print server's version */
  38. #define FIFO_VERSION "version"
  39. /* print available FIFO commands */
  40. #define FIFO_WHICH "which"
  41. /* print server's process table */
  42. #define FIFO_PS "ps"
  43. #define MAX_CTIME_LEN 128
  44. typedef int (fifo_cmd)( FILE *fifo_stream, char *response_file );
  45. struct fifo_command{
  46. fifo_cmd *f;
  47. struct fifo_command *next;
  48. void *param;
  49. char *name;
  50. };
  51. int register_fifo_cmd(fifo_cmd f, char *cmd_name, void *param);
  52. /* read a single EoL-terminated line from fifo */
  53. int read_line( char *b, int max, FILE *stream, int *read );
  54. /* consume EoL from fifo */
  55. int read_eol( FILE *stream );
  56. /* consume a set of EoL-terminated lines terminated by an additional EoL */
  57. int read_line_set(char *buf, int max_len, FILE *fifo, int *len);
  58. /* consume a set of EoL-terminated lines terminated by a single dot line */
  59. int read_body(char *buf, int max_len, FILE *fifo, int *len);
  60. int open_fifo_server();
  61. /* regsiter core FIFO command set */
  62. int register_core_fifo();
  63. FILE *open_reply_pipe( char *pipe_name );
  64. /* tell FIFO client an error occured via reply pipe */
  65. void fifo_reply( char *reply_fifo, char *reply_fmt, ... );
  66. #endif