Room Manager 0.1
room reservation management system
Macros | Typedefs | Functions
roomman.h File Reference
#include <stdlib.h>
#include <stdint.h>

Go to the source code of this file.

Macros

#define ROOMMAN_MAX_NAME   (31U)
 Global definitions.
 
#define ROOMMAN_SUCCESS   (0)
 
#define ROOMMAN_ERR_INVALID_ROOM   (-1)
 
#define ROOMMAN_ERR_DUPLICATE_ROOM   (-2)
 
#define ROOMMAN_ERR_NAMETOOLONG   (-3)
 
#define ROOMMAN_ERR_EXCEED   (-4)
 
#define ROOMMAN_ERR_NOUSER   (-5)
 
#define ROOMMAN_ERR_NOT_EMPTY   (-6)
 
#define ROOMMAN_ERR_RESERVED   (-7)
 
#define ROOMMAN_ERR_FATAL   (-100)
 
#define ROOMMAN_ERR_STORE   (-101)
 
#define ROOMMAN_ERR_CORRUPT   (-102)
 

Typedefs

typedef uint32_t roomman_id_t
 
typedef int16_t roomman_result_t
 

Functions

roomman_result_t roomman_set_username (char *username)
 Set the name of the current user (required for room reservations).
 
roomman_result_t roomman_create_room (char *building_name, char *room_name, uint16_t max_pers, roomman_id_t *rid)
 Create a new room.
 
roomman_result_t roomman_delete_room (roomman_id_t rid)
 Delete a room.
 
roomman_result_t roomman_update_capacity (roomman_id_t rid, uint16_t new_capacity)
 Update the capacity of a room.
 
roomman_result_t roomman_reserve_room (roomman_id_t rid)
 Reserve a room.
 
roomman_result_t roomman_clear_reservation (roomman_id_t rid)
 Reserve a room.
 
roomman_result_t roomman_add_persons (roomman_id_t rid, uint16_t persons)
 Increase the number of persons currently using the room.
 
roomman_result_t roomman_remove_persons (roomman_id_t rid, uint16_t persons)
 Decrease the number of persons currently using the room.
 
roomman_result_t roomman_readentry (roomman_id_t rid, char *building, char *name, uint16_t *occupied, uint16_t *capacity, char *reserved_by)
 Get contents of an entry in the database.
 
roomman_result_t roomman_lookup (const char *building, const char *room_name, roomman_id_t *rid)
 Find room in the database.
 
roomman_result_t roomman_directory (int32_t *fdptr, const char *building, const char *room_name, roomman_id_t *rid)
 Get a directory of entries in the database.
 

Detailed Description

Copyright (C) 2017 by Arno Nuehm

This software is distributed in the hope that it will be useful, or at least interesting, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

Definition in file roomman.h.

Macro Definition Documentation

◆ ROOMMAN_ERR_CORRUPT

#define ROOMMAN_ERR_CORRUPT   (-102)

Database corrupted

Definition at line 72 of file roomman.h.

◆ ROOMMAN_ERR_DUPLICATE_ROOM

#define ROOMMAN_ERR_DUPLICATE_ROOM   (-2)

Room ID is duplicate

Definition at line 51 of file roomman.h.

◆ ROOMMAN_ERR_EXCEED

#define ROOMMAN_ERR_EXCEED   (-4)

Room capacity exceeded or underflow detected

Definition at line 55 of file roomman.h.

◆ ROOMMAN_ERR_FATAL

#define ROOMMAN_ERR_FATAL   (-100)

Fatal errors - may be returned by any function returning a roomman_result_t Mark the minimum error code to indicate a fatal error.

Definition at line 68 of file roomman.h.

◆ ROOMMAN_ERR_INVALID_ROOM

#define ROOMMAN_ERR_INVALID_ROOM   (-1)

Invalid room number

Definition at line 49 of file roomman.h.

◆ ROOMMAN_ERR_NAMETOOLONG

#define ROOMMAN_ERR_NAMETOOLONG   (-3)

Provided name is too long

Definition at line 53 of file roomman.h.

◆ ROOMMAN_ERR_NOT_EMPTY

#define ROOMMAN_ERR_NOT_EMPTY   (-6)

Room is currently not empty

Definition at line 59 of file roomman.h.

◆ ROOMMAN_ERR_NOUSER

#define ROOMMAN_ERR_NOUSER   (-5)

User name not set

Definition at line 57 of file roomman.h.

◆ ROOMMAN_ERR_RESERVED

#define ROOMMAN_ERR_RESERVED   (-7)

Room is already reserved

Definition at line 61 of file roomman.h.

◆ ROOMMAN_ERR_STORE

#define ROOMMAN_ERR_STORE   (-101)

Error while storing the room information in the database

Definition at line 70 of file roomman.h.

◆ ROOMMAN_MAX_NAME

#define ROOMMAN_MAX_NAME   (31U)

Global definitions.

The maximum length of a room name

Definition at line 44 of file roomman.h.

◆ ROOMMAN_SUCCESS

#define ROOMMAN_SUCCESS   (0)

Operation successful

Definition at line 47 of file roomman.h.

Typedef Documentation

◆ roomman_id_t

typedef uint32_t roomman_id_t

Data type for room IDs

Definition at line 82 of file roomman.h.

◆ roomman_result_t

typedef int16_t roomman_result_t

Data type to indicate the success of an operation

Definition at line 87 of file roomman.h.