Back to index

im-sdk  12.3.91
role-data-server.c
Go to the documentation of this file.
00001 #include <stdlib.h>
00002 #include <string.h>
00003 #if defined(lint) && defined(HAVE_NOTE_H)
00004 #include <note.h>
00005 #endif /* lint && HAVE_NOTE_H */
00006 
00007 #include <iiimp.h>
00008 
00009 #include "input-method.h"
00010 #include "role-data-server.h"
00011 
00012 
00013 #define SERVICE_DEFAULT     "9010"
00014 
00015 
00016 IIIMF_status
00017 iiimf_role_data_server_new(
00018     const char *            service,
00019     IIIMF_role_data_server **      server_ret)
00020 {
00021     IIIMF_role_data_server *       server;
00022 
00023     server = (IIIMF_role_data_server *)malloc(sizeof (IIIMF_role_data_server));
00024     if (NULL == server) return IIIMF_STATUS_MALLOC;
00025 
00026     server->service = ((NULL == service) ?
00027                      strdup(SERVICE_DEFAULT) : strdup(service));
00028     if (NULL == server->service) {
00029        free(server);
00030        return IIIMF_STATUS_MALLOC;
00031     }
00032 
00033     *server_ret = server;
00034 
00035     return IIIMF_STATUS_SUCCESS;
00036 }
00037 
00038 
00039 void
00040 iiimf_role_data_server_delete(IIIMF_role_data_server * server)
00041 {
00042     free(server->service);
00043     free(server);
00044 }
00045 
00046 
00047 const char *
00048 iiimf_role_data_server_service(IIIMF_im * im)
00049 {
00050     return im->role_data.server->service;
00051 }
00052 
00053 
00054 /* Local Variables: */
00055 /* c-file-style: "iiim-project" */
00056 /* End: */