00001 #pragma once
00002 #ifndef SEAP_PACKET_H
00003 #define SEAP_PACKET_H
00004
00005 #include <seap-message.h>
00006 #include <seap-command.h>
00007 #include <seap-error.h>
00008
00009 #ifdef __cplusplus
00010 extern "C" {
00011 #endif
00012
00013 typedef struct SEAP_packet SEAP_packet_t;
00014
00015 #define SEAP_PACKET_INV 0x00
00016 #define SEAP_PACKET_MSG 0x01
00017 #define SEAP_PACKET_ERR 0x02
00018 #define SEAP_PACKET_CMD 0x03
00019 #define SEAP_PACKET_RAW 0x04
00020
00021 SEAP_packet_t *SEAP_packet_new (void);
00022 void SEAP_packet_free (SEAP_packet_t *packet);
00023
00024 void *SEAP_packet_settype (SEAP_packet_t *packet, uint8_t type);
00025 uint8_t SEAP_packet_gettype (SEAP_packet_t *packet);
00026
00027 SEAP_msg_t *SEAP_packet_msg (SEAP_packet_t *packet);
00028 SEAP_cmd_t *SEAP_packet_cmd (SEAP_packet_t *packet);
00029 SEAP_err_t *SEAP_packet_err (SEAP_packet_t *packet);
00030
00031 int SEAP_packet_recv (SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet);
00032 int SEAP_packet_recv_bytype (SEAP_CTX_t *ctx, int sd, SEAP_packet_t **packet, uint8_t type);
00033 int SEAP_packet_send (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
00034 int SEAP_packet_enqueue (SEAP_CTX_t *ctx, int sd, SEAP_packet_t *packet);
00035
00036 #ifdef __cplusplus
00037 }
00038 #endif
00039
00040 #endif