Rev 3990 | Rev 4243 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3990 | Rev 4192 | ||
---|---|---|---|
Line 49... | Line 49... | ||
49 | 49 | ||
50 | #include "packet.h" |
50 | #include "packet.h" |
51 | #include "packet_header.h" |
51 | #include "packet_header.h" |
52 | #include "packet_server.h" |
52 | #include "packet_server.h" |
53 | 53 | ||
- | 54 | /** The default address length reserved for new packets. |
|
- | 55 | */ |
|
- | 56 | #define DEFAULT_ADDR_LEN 32 |
|
- | 57 | ||
- | 58 | /** The default prefix reserved for new packets. |
|
- | 59 | */ |
|
- | 60 | #define DEFAULT_PREFIX 0 |
|
- | 61 | ||
- | 62 | /** The default suffix reserved for new packets. |
|
- | 63 | */ |
|
- | 64 | #define DEFAULT_SUFFIX 0 |
|
- | 65 | ||
54 | /** Returns the packet identifier message parameter. |
66 | /** Returns the packet identifier message parameter. |
55 | */ |
67 | */ |
56 | #define IPC_GET_ID( call ) ( packet_id_t ) IPC_GET_ARG1( * call ) |
68 | #define IPC_GET_ID( call ) ( packet_id_t ) IPC_GET_ARG1( * call ) |
57 | 69 | ||
58 | /** Returns the maximal content length message parameter. |
70 | /** Returns the maximal content length message parameter. |
Line 67... | Line 79... | ||
67 | */ |
79 | */ |
68 | #define IPC_GET_PREFIX( call ) ( size_t ) IPC_GET_ARG3( * call ) |
80 | #define IPC_GET_PREFIX( call ) ( size_t ) IPC_GET_ARG3( * call ) |
69 | 81 | ||
70 | /** Returns the maximal suffix length message parameter. |
82 | /** Returns the maximal suffix length message parameter. |
71 | */ |
83 | */ |
72 | #define IPC_GET_SUFIX( call ) ( size_t ) IPC_GET_ARG4( * call ) |
84 | #define IPC_GET_SUFFIX( call ) ( size_t ) IPC_GET_ARG4( * call ) |
73 | 85 | ||
74 | #define FREE_QUEUES_COUNT 7 |
86 | #define FREE_QUEUES_COUNT 7 |
75 | 87 | ||
76 | /** Packet server global data. |
88 | /** Packet server global data. |
77 | */ |
89 | */ |
Line 153... | Line 165... | ||
153 | * answer_count = 0; |
165 | * answer_count = 0; |
154 | switch( IPC_GET_METHOD( * call )){ |
166 | switch( IPC_GET_METHOD( * call )){ |
155 | case IPC_M_PHONE_HUNGUP: |
167 | case IPC_M_PHONE_HUNGUP: |
156 | return EOK; |
168 | return EOK; |
157 | case NET_PACKET_CREATE_1: |
169 | case NET_PACKET_CREATE_1: |
158 | packet = packet_get( 0, 0, IPC_GET_CONTENT( call ), 0 ); |
170 | packet = packet_get( DEFAULT_ADDR_LEN, DEFAULT_PREFIX, IPC_GET_CONTENT( call ), DEFAULT_SUFFIX ); |
159 | if( ! packet ) return ENOMEM; |
171 | if( ! packet ) return ENOMEM; |
160 | * answer_count = 2; |
172 | * answer_count = 2; |
161 | IPC_SET_ARG1( * answer, packet->packet_id ); |
173 | IPC_SET_ARG1( * answer, packet->packet_id ); |
162 | IPC_SET_ARG2( * answer, packet->length ); |
174 | IPC_SET_ARG2( * answer, packet->length ); |
163 | return EOK; |
175 | return EOK; |
164 | case NET_PACKET_CREATE_4: |
176 | case NET_PACKET_CREATE_4: |
165 | packet = packet_get( IPC_GET_ADDR_LEN( call ), IPC_GET_PREFIX( call ), IPC_GET_CONTENT( call ), IPC_GET_SUFIX( call )); |
177 | packet = packet_get( IPC_GET_ADDR_LEN( call ), IPC_GET_PREFIX( call ), IPC_GET_CONTENT( call ), IPC_GET_SUFFIX( call )); |
166 | if( ! packet ) return ENOMEM; |
178 | if( ! packet ) return ENOMEM; |
167 | * answer_count = 2; |
179 | * answer_count = 2; |
168 | IPC_SET_ARG1( * answer, packet->packet_id ); |
180 | IPC_SET_ARG1( * answer, packet->packet_id ); |
169 | IPC_SET_ARG2( * answer, packet->length ); |
181 | IPC_SET_ARG2( * answer, packet->length ); |
170 | return EOK; |
182 | return EOK; |