OSDN Git Service

*** empty log message ***
[drdeamon64/drdeamon64.git] / deamon / drd64_server_recvstatus.h
1 /*DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64
2
3                          D r . D e a m o n  6 4
4                         for INTEL64(R), AMD64(R)
5         
6    Copyright(C) 2007-2009 Koine Yuusuke(koinec). All rights reserved.
7
8 Redistribution and use in source and binary forms, with or without
9 modification, are permitted provided that the following conditions are met:
10
11  1. Redistributions of source code must retain the above copyright notice,
12     this list of conditions and the following disclaimer.
13  2. Redistributions in binary form must reproduce the above copyright
14     notice, this list of conditions and the following disclaimer in the
15     documentation and/or other materials provided with the distribution.
16
17 THIS SOFTWARE IS PROVIDED BY Koine Yuusuke(koinec) ``AS IS'' AND ANY
18 EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 DISCLAIMED. IN NO EVENT SHALL Koine Yuusuke(koinec) OR CONTRIBUTORS BE
21 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
27 OF THE POSSIBILITY OF SUCH DAMAGE.
28
29 DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64DrDeAmOn64*/
30
31 /* File Info -----------------------------------------------------------
32 File: drd64_.h
33 Function: Header 
34 Comment: 
35 ----------------------------------------------------------------------*/
36
37 #ifndef DRD64_HEADER_SERVER_RECVSTATUS
38 #define DRD64_HEADER_SERVER_RECVSTATUS
39
40 #include"../include/drd64_types.h"
41
42 #define DRD64_SERVER_RECVSTATUS_PHASE_POLL              0x00
43 #define DRD64_SERVER_RECVSTATUS_PHASE_HEADER    0x01
44 #define DRD64_SERVER_RECVSTATUS_PHASE_DATA              0x02
45 #define DRD64_SERVER_RECVSTATUS_PHASE_END               0x03
46
47 #define DRD64_SERVER_RECVSTATUS_STATUS_READ             0x00
48 #define DRD64_SERVER_RECVSTATUS_STATUS_STOP             0x01
49 #define DRD64_SERVER_RECVSTATUS_STATUS_RESUME   0x02
50 #define DRD64_SERVER_RECVSTATUS_STATUS_ERROR    0xff
51
52
53 typedef struct {
54         int             i_recvstatus_id;
55         int             i_fds_id;
56         void    *pv_buf;
57         void    *pv_resume;
58         int             i_remain_bytes;
59         int             i_read_phase;
60
61         Byte    b_recv_status;
62         int             i_command_status;       /* Cmd Proc. Use Area - for Cmd Status */
63
64         void    *pv_recv_before;
65         void    *pv_recv_next;
66 } Drd64_Server_RecvStatus;
67
68 #ifdef DRD64_SRC_SERVER_RECVSTATUS
69         #define EXTERN_SERVER_RECVSTATUS
70 #else
71         #define EXTERN_SERVER_RECVSTATUS        extern
72 #endif
73
74 EXTERN_SERVER_RECVSTATUS
75         int
76                 Drd64_Server_RecvStatus_Init(
77                         int i_alloc_units );
78
79 EXTERN_SERVER_RECVSTATUS
80         int
81                 Drd64_Server_RecvStatus_Term(
82                         void );
83
84 EXTERN_SERVER_RECVSTATUS
85         Drd64_Server_RecvStatus *
86                 Drd64_Server_RecvStatus_AllocRecvStatus(
87                         int i_fds,
88                         int i_alloc_units );
89
90 EXTERN_SERVER_RECVSTATUS
91         void
92                 Drd64_Server_RecvStatus_CloseRecvStatus(
93                         int i_fds );
94
95
96 EXTERN_SERVER_RECVSTATUS
97         int     
98                 Drd64_Server_RecvStatus_PushResumeChain(
99                         int     i_fds,
100                         int     i_alloc_units );
101
102 EXTERN_SERVER_RECVSTATUS
103         int
104                 Drd64_Server_RecvStatus_DeleteResumeChain(
105                         int     i_recv_id );
106
107 EXTERN_SERVER_RECVSTATUS
108         int
109                 Drd64_Server_RecvStatus_AddSocketsChain(
110                         Drd64_Server_RecvStatus *p_recv );
111
112 EXTERN_SERVER_RECVSTATUS
113         int
114                 Drd64_Server_RecvStatus_DeleteSocketsChain(
115                         Drd64_Server_RecvStatus *p_recv );
116
117
118 EXTERN_SERVER_RECVSTATUS
119         void
120                 Drd64_Server_RecvStatus_InitRecvStatus(
121                         Drd64_Server_RecvStatus *p_recv );
122
123 EXTERN_SERVER_RECVSTATUS
124         Drd64_Server_RecvStatus *
125                 Drd64_Server_RecvStatus_GetRecvStatus(
126                         int     i_recv_id );
127
128 EXTERN_SERVER_RECVSTATUS
129         int
130                 Drd64_Server_RecvStatus_GetSocketID(
131                         int     i_recv_id );
132
133 EXTERN_SERVER_RECVSTATUS
134         int
135                 Drd64_Server_RecvStatus_GetPacketStatus(
136                 int     i_recv_id );
137
138 EXTERN_SERVER_RECVSTATUS
139         int
140         Drd64_Server_RecvStatus_GetCmdStatus(
141                 int     i_recv_id );
142
143 EXTERN_SERVER_RECVSTATUS
144         int
145         Drd64_Server_RecvStatus_SetCmdStatus(
146                 int     i_recv_id,
147                 int     i_packet_status );
148
149
150 EXTERN_SERVER_RECVSTATUS
151         int
152                 Drd64_Server_RecvStatus_GetRecvStatMax(
153                         void );
154
155 EXTERN_SERVER_RECVSTATUS
156         Drd64_Server_RecvStatus *
157                 Drd64_Server_RecvStatus_GetResumeChainStart(
158                         void );
159
160
161 #endif  /* DRD64_HEADER_XXX */
162
163 /* EOF of drd64_.h ----------------------------------- */