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