flat_cmd.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * $Id$
  3. *
  4. * Copyright (C) 2004 FhG FOKUS
  5. * Copyright (C) 2008 iptelorg GmbH
  6. * Written by Jan Janak <[email protected]>
  7. *
  8. * This file is part of SER, a free SIP server.
  9. *
  10. * SER is free software; you can redistribute it and/or modify it under the
  11. * terms of the GNU General Public License as published by the Free Software
  12. * Foundation; either version 2 of the License, or (at your option) any later
  13. * version.
  14. *
  15. * SER is distributed in the hope that it will be useful, but WITHOUT ANY
  16. * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  17. * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  18. * details.
  19. *
  20. * You should have received a copy of the GNU General Public License along
  21. * with this program; if not, write to the Free Software Foundation, Inc.,
  22. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. */
  24. #ifndef _FLAT_CMD_H
  25. #define _FLAT_CMD_H
  26. /** \addtogroup flatstore
  27. * @{
  28. */
  29. /** \file
  30. * Inmplementation of flatstore commands.
  31. */
  32. #include "../../lib/srdb2/db_drv.h"
  33. #include "../../lib/srdb2/db_cmd.h"
  34. /** Extension structure of db_cmd adding flatstore specific data.
  35. * This data structure extends the generic data structure db_cmd in the
  36. * database API with data specific to the flatstore driver.
  37. */
  38. struct flat_cmd {
  39. db_drv_t gen; /**< Generic part of the data structure (must be first) */
  40. int file_index;
  41. };
  42. /** Creates a new flat_cmd data structure.
  43. * This function allocates and initializes memory for a new flat_cmd data
  44. * structure. The data structure is then attached to the generic db_cmd
  45. * structure in cmd parameter.
  46. * @param cmd A generic db_cmd structure to which the newly created flat_cmd
  47. * structure will be attached.
  48. */
  49. int flat_cmd(db_cmd_t* cmd);
  50. /** The main execution function in flat SER driver.
  51. * This is the main execution function in this driver. It is executed whenever
  52. * a SER module calls db_exec and the target database of the commands is
  53. * flatstore.
  54. * @param res A pointer to (optional) result structure if the command returns
  55. * a result.
  56. * @retval 0 if executed successfully
  57. * @retval A negative number if the database server failed to execute command
  58. * @retval A positive number if there was an error on client side (SER)
  59. */
  60. int flat_put(db_res_t* res, db_cmd_t* cmd);
  61. /** @} */
  62. #endif /* _FLAT_CMD_H */