00001
00002
00003
00004
00005
00006
00007
00008 #include "local.h"
00009 #include <stdlib.h>
00010 #include <dice/dice.h>
00011
00012 int ore_recv_string_blocking(l4ore_handle_t channel, int handle,
00013 char **data, l4_size_t *size,
00014 l4_timeout_t timeout)
00015 {
00016 int ret;
00017 l4_size_t real_size = *size;
00018 DICE_DECLARE_ENV(_dice_corba_env);
00019 _dice_corba_env.malloc = (dice_malloc_func)malloc;
00020 _dice_corba_env.free = (dice_free_func)free;
00021
00022 _dice_corba_env.timeout = timeout;
00023
00024 ret = ore_rxtx_recv_call(&channel, data, *size, &real_size,
00025 ORE_BLOCKING_CALL, &_dice_corba_env);
00026
00027
00028 if (DICE_HAS_EXCEPTION(&_dice_corba_env))
00029 {
00030 switch (DICE_EXCEPTION_MINOR(&_dice_corba_env))
00031 {
00032 case CORBA_DICE_EXCEPTION_IPC_ERROR:
00033
00034
00035 switch (DICE_IPC_ERROR(&_dice_corba_env))
00036 {
00037
00038
00039
00040
00041 case L4_IPC_REMSGCUT:
00042 ret = real_size;
00043 break;
00044 case L4_IPC_ENOT_EXISTENT:
00045 ret = -L4_ENOTFOUND;
00046 break;
00047 case L4_IPC_SETIMEOUT:
00048
00049 case L4_IPC_RETIMEOUT:
00050 ret = -L4_ETIME;
00051 break;
00052 default:
00053 ret = -L4_EIPC;
00054 break;
00055 }
00056 break;
00057 default:
00058
00059 LOG_Error("Unknown CORBA error: %d",
00060 DICE_EXCEPTION_MINOR(&_dice_corba_env));
00061 ret = -L4_EUNKNOWN;
00062 break;
00063 }
00064 }
00065 else
00066 *size = real_size;
00067
00068 return ret;
00069 }
00070
00071 int ore_recv_string_nonblocking(l4ore_handle_t channel, int handle,
00072 char **data, unsigned int *size)
00073 {
00074 unsigned int ret;
00075 unsigned int real_size;
00076 DICE_DECLARE_ENV(_dice_corba_env);
00077 _dice_corba_env.malloc = (dice_malloc_func)malloc;
00078 _dice_corba_env.free = (dice_free_func)free;
00079
00080 ret = ore_rxtx_recv_call(&channel, data, *size, &real_size,
00081 ORE_NONBLOCKING_CALL, &_dice_corba_env);
00082
00083
00084 if (DICE_HAS_EXCEPTION(&_dice_corba_env))
00085 {
00086 switch (DICE_EXCEPTION_MINOR(&_dice_corba_env))
00087 {
00088 case CORBA_DICE_EXCEPTION_IPC_ERROR:
00089
00090 switch (DICE_IPC_ERROR(&_dice_corba_env))
00091 {
00092
00093
00094
00095
00096 case L4_IPC_REMSGCUT:
00097 ret = real_size;
00098 break;
00099 case L4_IPC_ENOT_EXISTENT:
00100 ret = -L4_ENOTFOUND;
00101 break;
00102 default:
00103 ret = -L4_EIPC;
00104 break;
00105 }
00106 break;
00107 default:
00108
00109 ret = -L4_EUNKNOWN;
00110 break;
00111 }
00112 }
00113 else
00114 *size = real_size;
00115
00116 return ret;
00117 }