00001
00002
00003
00004
00005
00006
00007
00008 #include "local.h"
00009 #include <stdlib.h>
00010 #include <dice/dice.h>
00011
00012 void *l4ore_get_recv_area(int handle)
00013 {
00014 return descriptor_table[handle].recv_addr;
00015 }
00016
00017
00018
00019
00020
00021 int ore_recv_dsi_blocking(l4ore_handle_t channel, int handle,
00022 char **data, l4_size_t *size,
00023 l4_timeout_t timeout)
00024 {
00025 dsi_socket_t *sock = NULL;
00026 dsi_packet_t *pack = NULL;
00027 int ret;
00028
00029 sock = descriptor_table[handle].local_recv_socket;
00030
00031
00032 dsi_socket_set_flags(sock, DSI_SOCKET_BLOCK);
00033
00034 ret = dsi_packet_get(sock, &pack);
00035 if (ret)
00036 {
00037 LOG_Error("error on blocking receive: %d (%s)", ret,
00038 l4env_strerror(-ret));
00039 return ret;
00040 }
00041
00042 ret = dsi_packet_get_data(sock, pack, (void **)data, size);
00043 if (ret)
00044 {
00045 LOG_Error("error on packet_get_data: %d (%s)", ret,
00046 l4env_strerror(-ret));
00047 return ret;
00048 }
00049
00050 __l4ore_remember_packet(sock, pack, *data, *size);
00051
00052 return 0;
00053 }
00054
00055 int ore_recv_dsi_nonblocking(l4ore_handle_t channel, int handle,
00056 char **data, l4_size_t *size)
00057 {
00058 dsi_socket_t *sock = NULL;
00059 dsi_packet_t *pack = NULL;
00060 int ret;
00061
00062 sock = descriptor_table[handle].local_recv_socket;
00063
00064
00065 dsi_socket_clear_flags(sock, DSI_SOCKET_BLOCK);
00066
00067 ret = dsi_packet_get(sock, &pack);
00068 if (ret)
00069 {
00070 LOG_Error("error on non-blocking receive: %d (%s)", ret,
00071 l4env_strerror(-ret));
00072 return ret;
00073 }
00074
00075 ret = dsi_packet_get_data(sock, pack, (void **)data, size);
00076 if (ret)
00077 {
00078 LOG_Error("error on packet_get_data: %d (%s)", ret,
00079 l4env_strerror(-ret));
00080 return ret;
00081 }
00082
00083 __l4ore_remember_packet(sock, pack, *data, *size);
00084
00085 return 0;
00086 }