Back to index

im-sdk  12.3.91
Functions
IIIMP_IMState.cpp File Reference
#include <config.h>
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
#include "IMAccept.hh"
#include "IIIMP_IMState.hh"
#include "IIIMP_ICState.hh"
#include "IIIMProtocol.hh"
#include "IIIMPTrans.hh"
#include "IIIMPUtil.hh"
#include "IIIMP_hotkey_profile.hh"

Go to the source code of this file.

Functions

int open_ns (iml_desktop_t *desktop, int ns_id, char *path, int oflag, mode_t mode, int *ns_errno)
int read_ns (iml_desktop_t *desktop, int ns_id, void *ptr, size_t size, int *ns_errno)
int write_ns (iml_desktop_t *desktop, int ns_id, void *ptr, size_t size, int *ns_errno)
int update_supported_langlist_for_le (iml_desktop_t *desktop, IMLEName *lename, IMLocale *locales, int nLocales)
int switch_le_profile (iml_session_t *s, int le_profile_id, IMLEName *lename)
int close_ns (iml_desktop_t *desktop, int ns_id, int *ns_errno)
char ** opendir_ns (iml_desktop_t *desktop, int ns_id, char *path, int *nitems, int *pns_id, int ***d_reclen, int *ns_errno)
int closedir_ns (iml_desktop_t *desktop, int ns_id, int *ns_errno)
int mkdir_ns (iml_desktop_t *desktop, int ns_id, char *path, mode_t mode, int *ns_errno)
int rmdir_ns (iml_desktop_t *desktop, int ns_id, char *path, int *ns_errno)
int symlink_ns (iml_desktop_t *desktop, int ns_id, char *dpath, char *spath, int *ns_errno)
int stat_ns (iml_desktop_t *desktop, int ns_id, char *path, struct stat *buf, int *ns_errno)
int lstat_ns (iml_desktop_t *desktop, int ns_id, char *path, struct stat *buf, int *ns_errno)
int fstat_ns (iml_desktop_t *desktop, int ns_id, struct stat *buf, int *ns_errno)
int ftruncate_ns (iml_desktop_t *desktop, int ns_id, off_t length, int *ns_errno)
int creat_ns (iml_desktop_t *desktop, int ns_id, char *path, mode_t mode, int *ns_errno)
off_t lseek_ns (iml_desktop_t *desktop, int ns_id, off_t offset, int whence, int *ns_errno)
int unlink_ns (iml_desktop_t *desktop, int ns_id, char *path, int *ns_errno)
int rename_ns (iml_desktop_t *desktop, int ns_id, char *old_name, char *new_name, int *ns_errno)
int fcntl_ns (iml_desktop_t *desktop, int ns_id, int cmd, int arg, int *ns_errno)
int truncate_ns (iml_desktop_t *desktop, int ns_id, char *path, off_t length, int *ns_errno)

Function Documentation

int close_ns ( iml_desktop_t desktop,
int  ns_id,
int *  ns_errno 
)

Definition at line 1187 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_close *iiimp_close;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_close = iiimp_close_new(xims->get_iiimptrans()->get_data_s(),
                                  ns_id);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(), xims->get_im_id(), IIIMP_FILE_OPERATION_TYPE_CLOSE, iiimp_close);
    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_CLOSE_REPLY) {
       IIIMP_close_reply *p = (IIIMP_close_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int closedir_ns ( iml_desktop_t desktop,
int  ns_id,
int *  ns_errno 
)

Definition at line 1297 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_closedir *iiimp_closedir;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_closedir = iiimp_closedir_new(xims->get_iiimptrans()->get_data_s(),
                                        ns_id);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_CLOSEDIR,
                                       iiimp_closedir);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }
    
    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_CLOSEDIR_REPLY) {
       IIIMP_closedir_reply *p = (IIIMP_closedir_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int creat_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
mode_t  mode,
int *  ns_errno 
)

Definition at line 1762 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_creat *iiimp_creat;
    IIIMP_utf8string *iiimp_fname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_fname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                       (strlen(path) + 1),
                                   (const IIIMP_card8 *)path);
    if (!iiimp_fname) return -1;

    iiimp_creat = iiimp_creat_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id, mode, iiimp_fname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_CREAT,
                                       iiimp_creat);
    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_CREAT_REPLY) {
       IIIMP_creat_reply *p = (IIIMP_creat_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int fcntl_ns ( iml_desktop_t desktop,
int  ns_id,
int  cmd,
int  arg,
int *  ns_errno 
)

Definition at line 1974 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_fcntl *iiimp_fcntl;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_fcntl = iiimp_fcntl_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id, cmd, arg);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_FCNTL,
                                       iiimp_fcntl);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_FCNTL_REPLY) {
       IIIMP_fcntl_reply *p = (IIIMP_fcntl_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->return_value;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int fstat_ns ( iml_desktop_t desktop,
int  ns_id,
struct stat *  buf,
int *  ns_errno 
)

Definition at line 1652 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_fstat *iiimp_fstat;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_fstat = iiimp_fstat_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_FSTAT,
                                       iiimp_fstat);
    if(!xims->send(send_message, true)) return -1;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_FSTAT_REPLY) {
       IIIMP_fstat_reply *p = (IIIMP_fstat_reply *)receive_message->v.file_operation_reply.value;
       if (p->ns_id < 0) {
           return p->ns_id;
       }

       (*buf).st_mode = p->stat_buf->s_mode;
       (*buf).st_nlink = p->stat_buf->s_nlink;
       (*buf).st_uid = p->stat_buf->s_uid;
       (*buf).st_gid = p->stat_buf->s_gid;
       (*buf).st_atime = p->stat_buf->s_atime;
       (*buf).st_mtime = p->stat_buf->s_mtime;
       (*buf).st_ctime = p->stat_buf->s_ctime;
       (*buf).st_blksize = p->stat_buf->s_blksize;
       (*buf).st_dev = p->stat_buf->s_dev;
       (*buf).st_rdev = p->stat_buf->s_rdev;
       (*buf).st_ino = p->stat_buf->s_ino;
       (*buf).st_size = p->stat_buf->s_size;
       (*buf).st_blocks = p->stat_buf->s_blocks;

       *ns_errno =  p->ns_errno;
       return p->ns_id;
    }

    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int ftruncate_ns ( iml_desktop_t desktop,
int  ns_id,
off_t  length,
int *  ns_errno 
)

Definition at line 1716 of file IIIMP_IMState.cpp.

{               
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_ftruncate *iiimp_ftruncate;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;
    
    if (xims == NULL)
       return -1;
    iiimp_ftruncate = iiimp_ftruncate_new(xims->get_iiimptrans()->get_data_s(),    
                                     ns_id, length);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_FTRUNCATE,
                                       iiimp_ftruncate);

    if(!xims->send(send_message, true)) return -1;
    
    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
            if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
                LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
                break;
            } else {
                xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
            }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_FTRUNCATE_REPLY) {
       IIIMP_ftruncate_reply *p = (IIIMP_ftruncate_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

off_t lseek_ns ( iml_desktop_t desktop,
int  ns_id,
off_t  offset,
int  whence,
int *  ns_errno 
)

Definition at line 1814 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_lseek *iiimp_lseek;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_lseek = iiimp_lseek_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id, offset, whence);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_LSEEK,
                                       iiimp_lseek);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_LSEEK) {
       IIIMP_lseek_reply *p = (IIIMP_lseek_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->offset;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int lstat_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
struct stat *  buf,
int *  ns_errno 
)

Definition at line 1580 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_lstat *iiimp_lstat;
    IIIMP_utf8string *iiimp_dirname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_dirname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                         (strlen(path) + 1),
                                         (const IIIMP_card8 *)path);
    if (!iiimp_dirname) return -1;

    iiimp_lstat = iiimp_lstat_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id, iiimp_dirname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_LSTAT,
                                       iiimp_lstat);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_LSTAT_REPLY) {
       IIIMP_lstat_reply *p = (IIIMP_lstat_reply *)receive_message->v.file_operation_reply.value;
       if (p->ns_id < 0) {
           return p->ns_id;
       }

       (*buf).st_mode = p->stat_buf->s_mode;
       (*buf).st_nlink = p->stat_buf->s_nlink;
       (*buf).st_uid = p->stat_buf->s_uid;
       (*buf).st_gid = p->stat_buf->s_gid;
       (*buf).st_atime = p->stat_buf->s_atime;
       (*buf).st_mtime = p->stat_buf->s_mtime;
       (*buf).st_ctime = p->stat_buf->s_ctime;
       (*buf).st_blksize = p->stat_buf->s_blksize;
       (*buf).st_dev = p->stat_buf->s_dev;
       (*buf).st_rdev = p->stat_buf->s_rdev;
       (*buf).st_ino = p->stat_buf->s_ino;
       (*buf).st_size = p->stat_buf->s_size;
       (*buf).st_blocks = p->stat_buf->s_blocks;

       *ns_errno =  p->ns_errno;
       return p->ns_id;
    }

    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int mkdir_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
mode_t  mode,
int *  ns_errno 
)

Definition at line 1342 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_mkdir *iiimp_mkdir;
    IIIMP_utf8string *iiimp_dirname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_dirname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                         (strlen(path) + 1),
                                         (const IIIMP_card8 *)path);
    if (!iiimp_dirname) return -1;

    iiimp_mkdir = iiimp_mkdir_new(xims->get_iiimptrans()->get_data_s(),
                              ns_id, mode, iiimp_dirname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_MKDIR,
                                       iiimp_mkdir);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_MKDIR_REPLY) {
       IIIMP_mkdir_reply *p = (IIIMP_mkdir_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int open_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
int  oflag,
mode_t  mode,
int *  ns_errno 
)

Definition at line 974 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_open *iiimp_open;
    IIIMP_utf8string *iiimp_fname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_fname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                   (strlen(path) + 1),
                                   (const IIIMP_card8 *)path);
    if (!iiimp_fname) return -1;

    iiimp_open = iiimp_open_new(xims->get_iiimptrans()->get_data_s(),
                            ns_id,
                            mode,
                            iiimp_fname);

    send_message = iiimp_file_operation_new(
       xims->get_iiimptrans()->get_data_s(),
       xims->get_im_id(),
       IIIMP_FILE_OPERATION_TYPE_OPEN,
       iiimp_open);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_OPEN_REPLY) {
       IIIMP_open_reply *p = (IIIMP_open_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

char** opendir_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
int *  nitems,
int *  pns_id,
int ***  d_reclen,
int *  ns_errno 
)

Definition at line 1228 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_opendir *iiimp_opendir;
    IIIMP_utf8string *iiimp_dirname;
    char **d_name;
    unsigned int i,j;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return NULL;
    iiimp_dirname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                         (strlen(path) + 1),
                                         (const IIIMP_card8 *)path);
    if (!iiimp_dirname) return (char **)NULL;

    iiimp_opendir = iiimp_opendir_new(xims->get_iiimptrans()->get_data_s(),
                                      ns_id, iiimp_dirname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(), xims->get_im_id(), IIIMP_FILE_OPERATION_TYPE_OPENDIR, iiimp_opendir);

    if(!xims->send(send_message, true)) return (char **)NULL;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_OPENDIR_REPLY) {
       IIIMP_opendir_reply *por = (IIIMP_opendir_reply *)receive_message->v.file_operation_reply.value;
       *nitems = por->nitems;
       *pns_id = por->ns_id;
       *ns_errno = por->ns_errno;
       if (*nitems > 0) {
           IIIMP_utf8string *p = por->d_name;
           d_name = (char **) calloc (*nitems, (sizeof (char *)));
           *d_reclen = (int **) calloc(*nitems, sizeof(int *));
           for (i=0; NULL != p; p=p->next, i++) {
              d_name[i] = (char *) calloc((p->len + 1), sizeof(char));
              (*d_reclen)[i] = (int *) calloc(1, sizeof(int));
              (*d_reclen)[i] = (int *) p->len;
              for (j=0; j<p->len; j++) {
                  d_name[i][j] = p->ptr[j];
              }
           }
           return d_name;
       }
    }
    return (char **)NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int read_ns ( iml_desktop_t desktop,
int  ns_id,
void *  ptr,
size_t  size,
int *  ns_errno 
)

Definition at line 1031 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_read *iiimp_read;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_read = iiimp_read_new(xims->get_iiimptrans()->get_data_s(), 
                            ns_id, size);
    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_READ,
                                       iiimp_read);
    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
       if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
               xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
       }
    }
    if (!ptr) return -1;

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_READ_REPLY) {
       IIIMP_read_reply *p = (IIIMP_read_reply *)receive_message->v.file_operation_reply.value;
       memcpy((char *)ptr, (char *)p->object, p->size);
       *ns_errno = p->ns_errno;
       return p->size;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rename_ns ( iml_desktop_t desktop,
int  ns_id,
char *  old_name,
char *  new_name,
int *  ns_errno 
)

Definition at line 1913 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_rename *iiimp_rename;
    IIIMP_utf8string *iiimp_old_name;
    IIIMP_utf8string *iiimp_new_name;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_old_name = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                          (strlen(old_name) + 1),
                                      (const IIIMP_card8 *)old_name);
    if (!iiimp_old_name) return -1;

    iiimp_new_name = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                          (strlen(new_name) + 1),
                                      (const IIIMP_card8 *)new_name);
    if (!iiimp_new_name) return -1;

    iiimp_rename = iiimp_rename_new(xims->get_iiimptrans()->get_data_s(),
                                ns_id, 
                                iiimp_old_name, 
                                iiimp_new_name);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_RENAME,
                                       iiimp_rename);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_RENAME_REPLY) {
       IIIMP_rename_reply *p = (IIIMP_rename_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int rmdir_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
int *  ns_errno 
)

Definition at line 1395 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_rmdir *iiimp_rmdir;
    IIIMP_utf8string *iiimp_dirname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_dirname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                         (strlen(path) + 1),
                                         (const IIIMP_card8 *)path);
    if (!iiimp_dirname) return -1;

    iiimp_rmdir = iiimp_rmdir_new(xims->get_iiimptrans()->get_data_s(),
                                  ns_id, iiimp_dirname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_RMDIR,
                                       iiimp_rmdir);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_RMDIR_REPLY) {
       IIIMP_rmdir_reply *p = (IIIMP_rmdir_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int stat_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
struct stat *  buf,
int *  ns_errno 
)

Definition at line 1508 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_stat *iiimp_stat;
    IIIMP_utf8string *iiimp_dirname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_dirname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                         (strlen(path) + 1),
                                         (const IIIMP_card8 *)path);
    if (!iiimp_dirname) return -1;

    iiimp_stat = iiimp_stat_new(xims->get_iiimptrans()->get_data_s(),
                            ns_id, iiimp_dirname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_STAT,
                                       iiimp_stat);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !! \n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_STAT_REPLY) {
       IIIMP_stat_reply *p = (IIIMP_stat_reply *)receive_message->v.file_operation_reply.value;
       if (p->ns_id < 0) {
           return p->ns_id;
       }

       (*buf).st_mode = p->stat_buf->s_mode;
       (*buf).st_nlink = p->stat_buf->s_nlink;
       (*buf).st_uid = p->stat_buf->s_uid;
       (*buf).st_gid = p->stat_buf->s_gid;
       (*buf).st_atime = p->stat_buf->s_atime;
       (*buf).st_mtime = p->stat_buf->s_mtime;
       (*buf).st_ctime = p->stat_buf->s_ctime;
       (*buf).st_blksize = p->stat_buf->s_blksize;
       (*buf).st_dev = p->stat_buf->s_dev;
       (*buf).st_rdev = p->stat_buf->s_rdev;
       (*buf).st_ino = p->stat_buf->s_ino;
       (*buf).st_size = p->stat_buf->s_size;
       (*buf).st_blocks = p->stat_buf->s_blocks;

       *ns_errno =  p->ns_errno;
       return p->ns_id;
    }

    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int switch_le_profile ( iml_session_t s,
int  le_profile_id,
IMLEName lename 
)

Definition at line 1150 of file IIIMP_IMState.cpp.

{   
    static int num = 0;
    IIIMP_message *send_message;
    ICState *pics = ((IMLExec_ICState *)s->SessionContext)->get_icstate();
    IIIMP_IMState *xims = (IIIMP_IMState *)pics->get_imstate();
    int default_profile_id;
    int profile_id;
    IIIMP_card16 scope_and_profile_id;

    if (xims == NULL) {
       LOG_DEBUG("IIIMP_IMState: xims is NULL \n");
       return false;
    }
    default_profile_id = xims->get_hotkey_profile()->get_default_hotkey_profile_id();
    profile_id = xims->get_hotkey_profile()->get_unique_profile_id(le_profile_id, lename);
    
    if (profile_id < 0) {
       profile_id = default_profile_id;
    }

    LOG_DEBUG("IIIMP_IMState: xims [0x%x], Switching HotkeyProfile [%d]\n", xims, num++);
    LOG_DEBUG("IIIMP_IMState: LE [%s] switching profile to [%d]\n",lename->id, profile_id);

    // Switch to LE's profile
    scope_and_profile_id = (GLOBAL_HOTKEY << 15) | profile_id;
    send_message = iiimp_select_hotkey_profile_new(xims->get_iiimptrans()->get_data_s(), xims->get_im_id(), scope_and_profile_id);
    if (!xims->send(send_message, true)) return false;

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int symlink_ns ( iml_desktop_t desktop,
int  ns_id,
char *  dpath,
char *  spath,
int *  ns_errno 
)

Definition at line 1447 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_symlink *iiimp_symlink;
    IIIMP_utf8string *iiimp_dname;
    IIIMP_utf8string *iiimp_sname;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_dname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                       (strlen(dpath) + 1),
                                   (const IIIMP_card8 *)dpath);
                               
    if (!iiimp_dname) return -1;

    iiimp_sname = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                       (strlen(spath) + 1),
                                       (const IIIMP_card8 *)spath);
                                   
    if (!iiimp_sname) return -1;

    iiimp_symlink = iiimp_symlink_new(xims->get_iiimptrans()->get_data_s(),
                                      ns_id, iiimp_dname, iiimp_sname);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_SYMLINK,
                                       iiimp_symlink);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_SYMLINK_REPLY) {
       IIIMP_symlink_reply *p = (IIIMP_symlink_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int truncate_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
off_t  length,
int *  ns_errno 
)

Definition at line 2021 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_truncate *iiimp_truncate;
    IIIMP_utf8string *iiimp_path;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_path = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                      (strlen(path) + 1),
                                  (const IIIMP_card8 *)path);
    if (!iiimp_path) return -1;

    iiimp_truncate = iiimp_truncate_new(xims->get_iiimptrans()->get_data_s(),
                                   ns_id, iiimp_path, length);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_TRUNCATE,
                                       iiimp_truncate);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_TRUNCATE_REPLY) {
       IIIMP_truncate_reply *p = (IIIMP_truncate_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int unlink_ns ( iml_desktop_t desktop,
int  ns_id,
char *  path,
int *  ns_errno 
)

Definition at line 1861 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_unlink *iiimp_unlink;
    IIIMP_utf8string *iiimp_path;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_path = iiimp_utf8string_new(xims->get_iiimptrans()->get_data_s(),
                                      (strlen(path) + 1),
                                  (const IIIMP_card8 *)path);
    if (!iiimp_path) return -1;

    iiimp_unlink = iiimp_unlink_new(xims->get_iiimptrans()->get_data_s(),
                                ns_id, iiimp_path);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(),
                                       xims->get_im_id(),
                                       IIIMP_FILE_OPERATION_TYPE_UNLINK,
                                       iiimp_unlink);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
       receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_UNLINK_REPLY) {
       IIIMP_unlink_reply *p = (IIIMP_unlink_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->ns_id;
    }
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int update_supported_langlist_for_le ( iml_desktop_t desktop,
IMLEName lename,
IMLocale locales,
int  nLocales 
)

Definition at line 1124 of file IIIMP_IMState.cpp.

{
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);

    if (xims == NULL)
       return false;
    // Update LEMgr's IMDescriptorList

    xims->get_imhandler()->update_imdesclist(lename, locales, nLocales);

    // TODO!! Send the updated IMDescriptorList to Client using IM_SETIMVALUES
    // IIIMP_IMState_Identified *xims_id = new IIIMP_IMState_Identified(xims, xims->get_imhandler(), xims->get_current_protocol_version());
    // xims_id->set_data_to_client();
    // receive_message = xims->get_iiimptrans()->receive();

    return true;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int write_ns ( iml_desktop_t desktop,
int  ns_id,
void *  ptr,
size_t  size,
int *  ns_errno 
)

Definition at line 1078 of file IIIMP_IMState.cpp.

{
    IIIMP_message *send_message;
    IIIMP_message *receive_message;
    IIIMP_write *iiimp_write;
    IIIMP_IMState *xims = IIIMP_IMState::get_imstate_from_desktop(desktop);
    *ns_errno = 0;

    if (xims == NULL)
       return -1;
    iiimp_write = iiimp_write_new(xims->get_iiimptrans()->get_data_s(),
                                  ns_id, size, ptr);

    send_message = iiimp_file_operation_new(xims->get_iiimptrans()->get_data_s(), xims->get_im_id(), IIIMP_FILE_OPERATION_TYPE_WRITE, iiimp_write);

    if(!xims->send(send_message, true)) return -1;

    for (;;) {
        receive_message = xims->get_iiimptrans()->receive();
        if (receive_message) {
           if (receive_message->opcode == IM_FILE_OPERATION_REPLY) {
              LOG_DEBUG("Got IM_FILE_OPERATION_REPLY !!\n");
              break;
           } else {
              xims->dispatch(receive_message->im_id, receive_message->ic_id, receive_message);
           }
        }
    }
    if (!ptr) return -1;

    if (receive_message->v.file_operation_reply.type == IIIMP_FILE_OPERATION_TYPE_WRITE_REPLY) {
       IIIMP_write_reply *p = (IIIMP_write_reply *)receive_message->v.file_operation_reply.value;
       *ns_errno = p->ns_errno;
       return p->size;
    }
    
    return -1;
}

Here is the call graph for this function:

Here is the caller graph for this function: