2005-11-03 08:22:10 +00:00
|
|
|
/**
|
|
|
|
* @file types.h
|
|
|
|
*
|
2005-12-06 13:07:06 +00:00
|
|
|
* @brief Generic types.
|
2005-11-03 08:22:10 +00:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2005 Jan Hutter, Martin Willi
|
|
|
|
* Hochschule fuer Technik Rapperswil
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms of the GNU General Public License as published by the
|
|
|
|
* Free Software Foundation; either version 2 of the License, or (at your
|
|
|
|
* option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef TYPES_H_
|
|
|
|
#define TYPES_H_
|
|
|
|
|
2005-11-17 17:22:08 +00:00
|
|
|
#include <gmp.h>
|
2005-11-10 09:12:37 +00:00
|
|
|
#include <sys/types.h>
|
2005-11-14 07:15:43 +00:00
|
|
|
#include <stdlib.h>
|
2005-11-08 08:43:33 +00:00
|
|
|
|
2005-11-23 09:24:35 +00:00
|
|
|
#include <definitions.h>
|
2005-11-17 09:05:55 +00:00
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
|
2005-11-24 11:30:19 +00:00
|
|
|
typedef enum status_t status_t;
|
|
|
|
|
|
|
|
/**
|
2005-12-06 13:07:06 +00:00
|
|
|
* Return values of function calls.
|
2005-11-24 11:30:19 +00:00
|
|
|
*/
|
|
|
|
enum status_t {
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Call succeeded.
|
|
|
|
*/
|
2005-11-03 08:22:10 +00:00
|
|
|
SUCCESS,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Call failed.
|
|
|
|
*/
|
2005-11-03 08:56:01 +00:00
|
|
|
FAILED,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Out of ressources.
|
|
|
|
*/
|
|
|
|
|
2005-11-03 09:46:08 +00:00
|
|
|
OUT_OF_RES,
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Already done.
|
|
|
|
*/
|
2005-11-07 08:23:52 +00:00
|
|
|
ALREADY_DONE,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Not supported.
|
|
|
|
*/
|
2005-11-08 12:47:44 +00:00
|
|
|
NOT_SUPPORTED,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* One of the arguments is invalid.
|
|
|
|
*/
|
2005-11-08 12:47:44 +00:00
|
|
|
INVALID_ARG,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Something could not be found.
|
|
|
|
*/
|
2005-11-10 17:17:46 +00:00
|
|
|
NOT_FOUND,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Error while parsing.
|
|
|
|
*/
|
2005-11-10 19:20:13 +00:00
|
|
|
PARSE_ERROR,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Error while verifying.
|
|
|
|
*/
|
2005-11-16 17:20:03 +00:00
|
|
|
VERIFY_ERROR,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Object in invalid state.
|
|
|
|
*/
|
2005-12-02 07:43:05 +00:00
|
|
|
INVALID_STATE,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Delete object which function belongs to.
|
|
|
|
*/
|
2005-12-02 07:43:05 +00:00
|
|
|
DELETE_ME,
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* An object got created.
|
|
|
|
*/
|
2005-12-06 12:27:09 +00:00
|
|
|
CREATED,
|
2005-11-24 11:30:19 +00:00
|
|
|
};
|
2005-11-03 08:22:10 +00:00
|
|
|
|
2005-11-17 09:05:55 +00:00
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* String mappings for type status_t.
|
|
|
|
*/
|
|
|
|
extern mapping_t status_m[];
|
2005-11-08 08:43:33 +00:00
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Handle struct timeval like an own type.
|
|
|
|
*/
|
2005-11-04 13:21:25 +00:00
|
|
|
typedef struct timeval timeval_t;
|
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Handle struct timespec like an own type.
|
|
|
|
*/
|
2005-11-04 13:21:25 +00:00
|
|
|
typedef struct timespec timespec_t;
|
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Handle struct chunk_t like an own type.
|
|
|
|
*/
|
2005-11-16 16:08:44 +00:00
|
|
|
typedef struct sockaddr sockaddr_t;
|
|
|
|
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Use struct chunk_t as chunk_t.
|
|
|
|
*/
|
2005-11-24 11:30:19 +00:00
|
|
|
typedef struct chunk_t chunk_t;
|
|
|
|
|
2005-11-10 09:12:37 +00:00
|
|
|
/**
|
2005-12-06 13:07:06 +00:00
|
|
|
* General purpose pointer/length abstraction.
|
2005-11-10 09:12:37 +00:00
|
|
|
*/
|
2005-11-24 11:30:19 +00:00
|
|
|
struct chunk_t {
|
2005-12-06 13:07:06 +00:00
|
|
|
/**
|
|
|
|
* Pointer to start of data
|
|
|
|
*/
|
2005-11-10 09:12:37 +00:00
|
|
|
u_char *ptr;
|
2005-12-06 13:07:06 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Length of data in bytes
|
|
|
|
*/
|
2005-11-10 09:12:37 +00:00
|
|
|
size_t len;
|
|
|
|
};
|
|
|
|
|
2005-11-24 11:30:19 +00:00
|
|
|
/**
|
|
|
|
* {NULL, 0}-chunk, handy for initialization
|
|
|
|
* of chunks.
|
|
|
|
*/
|
2005-11-23 07:16:55 +00:00
|
|
|
extern chunk_t CHUNK_INITIALIZER;
|
|
|
|
|
2005-11-10 09:12:37 +00:00
|
|
|
/**
|
2005-12-06 13:07:06 +00:00
|
|
|
* General purpose boolean type.
|
2005-11-10 09:12:37 +00:00
|
|
|
*/
|
|
|
|
typedef int bool;
|
|
|
|
#define FALSE 0
|
2005-12-06 13:07:06 +00:00
|
|
|
#define TRUE 1
|
2005-11-17 17:22:08 +00:00
|
|
|
|
2005-11-03 08:22:10 +00:00
|
|
|
#endif /*TYPES_H_*/
|