Author: marten Date: Thu Oct 15 19:38:09 2009 New Revision: 1199 Log: Added header for the community-operator protocol Added: trunk/community-operator/co_common_packets.h Added: trunk/community-operator/co_common_packets.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ trunk/community-operator/co_common_packets.h Thu Oct 15 19:38:09 2009 (r1199) @@ -0,0 +1,61 @@ +/* + * Copyright (c) 2009, Distributed Systems Group, RWTH Aachen + * All rights reserved. + */ + +#ifndef PISA_CO_COMMON_PACKETS_H +#define PISA_CO_COMMON_PACKETS_H + +#include <netinet/in.h> + +#include "global.h" + +#define LENGTH_ERROR_MESSAGE 128 + +// Message types +#define MESSAGE_CERTIFICATE_REQUEST 0 +#define MESSAGE_CERTIFICATE_DENY 1 +#define MESSAGE_CERTIFICATE_ACCEPT 2 +#define MESSAGE_ERROR 3 + +// Deny reasons +#define DENY_HIT_NOT_ALLOWED 0 +#define DENY_HIT_EXPIRED 1 +#define DENY_UNKNOWN_ERROR 2 + +typedef struct co_certificate_request +{ + +} __attribute__ ((packed)) co_certificate_request; + +typedef struct co_certificate_deny +{ + uint8_t reason; +} __attribute__ ((packed)) co_certificate_deny; + +typedef struct co_certificate +{ + char cert[PISA_CERT_LENGTH]; +} __attribute__ ((packed)) co_certificate; + +typedef struct co_error +{ + uint8_t error_type; + uint8_t error_message[LENGTH_ERROR_MESSAGE]; +} __attribute__ ((packed)) co_error; + +/* General Community-Operator packet */ +typedef struct co_packet +{ + uint8_t message_type; + + union message { + co_certificate_request request; + co_certificate_deny deny; + co_certificate cert; + co_error error; + } message; + +} __attribute__ ((packed)) co_packet; + +#endif /* PISA_CO_COMMON_PACKETS_H */