Subversion Repositories HelenOS

Rev

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 34... Line 34...
34
 *  Packet client implementation.
34
 *  Packet client implementation.
35
 */
35
 */
36
 
36
 
37
#include <async.h>
37
#include <async.h>
38
#include <errno.h>
38
#include <errno.h>
-
 
39
#include <mem.h>
39
#include <unistd.h>
40
#include <unistd.h>
40
//#include <stdio.h>
41
//#include <stdio.h>
41
#include <string.h>
-
 
42
 
42
 
43
#include <ipc/ipc.h>
43
#include <ipc/ipc.h>
44
#include <sys/mman.h>
44
#include <sys/mman.h>
45
 
45
 
46
#include "../../err.h"
46
#include "../../err.h"
Line 120... Line 120...
120
    if( ! packet_is_valid( packet )) return EINVAL;
120
    if( ! packet_is_valid( packet )) return EINVAL;
121
    if( packet->addr_len >= addr_len ) return ENOMEM;
121
    if( packet->addr_len >= addr_len ) return ENOMEM;
122
    padding = packet->addr_len - addr_len;
122
    padding = packet->addr_len - addr_len;
123
    if( src ){
123
    if( src ){
124
        memcpy(( void * ) packet + packet->src_addr, src, addr_len );
124
        memcpy(( void * ) packet + packet->src_addr, src, addr_len );
125
        memset(( void * ) packet + packet->src_addr + addr_len, 0, padding );
125
        bzero(( void * ) packet + packet->src_addr + addr_len, padding );
126
    }else{
126
    }else{
127
        memset(( void * ) packet + packet->src_addr + addr_len, 0, packet->addr_len );
127
        bzero(( void * ) packet + packet->src_addr + addr_len, packet->addr_len );
128
    }
128
    }
129
    if( dest ){
129
    if( dest ){
130
        memcpy(( void * ) packet + packet->dest_addr, dest, addr_len );
130
        memcpy(( void * ) packet + packet->dest_addr, dest, addr_len );
131
        memset(( void * ) packet + packet->dest_addr + addr_len, 0, padding );
131
        bzero(( void * ) packet + packet->dest_addr + addr_len, padding );
132
    }else{
132
    }else{
133
        memset(( void * ) packet + packet->dest_addr + addr_len, 0, packet->addr_len );
133
        bzero(( void * ) packet + packet->dest_addr + addr_len, packet->addr_len );
134
    }
134
    }
135
    return EOK;
135
    return EOK;
136
}
136
}
137
 
137
 
138
int packet_translate( int phone, packet_ref packet, packet_id_t packet_id ){
138
int packet_translate( int phone, packet_ref packet, packet_id_t packet_id ){
Line 192... Line 192...
192
        return NULL;
192
        return NULL;
193
    }
193
    }
194
    return packet;
194
    return packet;
195
}
195
}
196
 
196
 
197
void packet_release( int phone, packet_id_t packet_id ){
197
void pq_release( int phone, packet_id_t packet_id ){
198
    async_msg_1( phone, NET_PACKET_RELEASE, packet_id );
198
    async_msg_1( phone, NET_PACKET_RELEASE, packet_id );
199
}
199
}
200
 
200
 
201
/** @}
201
/** @}
202
 */
202
 */