Rev 4395 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 4395 | Rev 4505 | ||
|---|---|---|---|
| Line 32... | Line 32... | ||
| 32 | 32 | ||
| 33 | /** @file |
33 | /** @file |
| 34 | * Packet client implementation. |
34 | * Packet client implementation. |
| 35 | */ |
35 | */ |
| 36 | 36 | ||
| 37 | #include <async.h> |
- | |
| 38 | #include <errno.h> |
37 | #include <errno.h> |
| 39 | #include <mem.h> |
38 | #include <mem.h> |
| 40 | #include <unistd.h> |
39 | #include <unistd.h> |
| 41 | //#include <stdio.h> |
40 | //#include <stdio.h> |
| 42 | 41 | ||
| 43 | #include <ipc/ipc.h> |
- | |
| 44 | #include <sys/mman.h> |
42 | #include <sys/mman.h> |
| 45 | 43 | ||
| 46 | #include "../../err.h" |
- | |
| 47 | #include "../../messages.h" |
44 | #include "../../messages.h" |
| 48 | 45 | ||
| 49 | #include "packet.h" |
46 | #include "packet.h" |
| 50 | #include "packet_header.h" |
47 | #include "packet_header.h" |
| 51 | #include "packet_client.h" |
48 | #include "packet_client.h" |
| Line 59... | Line 56... | ||
| 59 | } |
56 | } |
| 60 | return EOK; |
57 | return EOK; |
| 61 | } |
58 | } |
| 62 | 59 | ||
| 63 | void * packet_prefix( packet_t packet, size_t length ){ |
60 | void * packet_prefix( packet_t packet, size_t length ){ |
| 64 | if(( ! packet_is_valid( packet )) || ( packet->data_start - sizeof( struct packet ) - 2 * packet->addr_len < length )) return NULL; |
61 | if(( ! packet_is_valid( packet )) || ( packet->data_start - sizeof( struct packet ) - 2 * ( packet->dest_addr - packet->src_addr ) < length )) return NULL; |
| 65 | packet->data_start -= length; |
62 | packet->data_start -= length; |
| 66 | return ( void * ) packet + packet->data_start; |
63 | return ( void * ) packet + packet->data_start; |
| 67 | } |
64 | } |
| 68 | 65 | ||
| 69 | void * packet_suffix( packet_t packet, size_t length ){ |
66 | void * packet_suffix( packet_t packet, size_t length ){ |