diff --git a/src/appclient.c b/src/appclient.c index 4cde1a6..670251f 100644 --- a/src/appclient.c +++ b/src/appclient.c @@ -219,6 +219,7 @@ AppClient * appclient_new(char const * app) /* appclient_new_event */ static int _new_connect(AppClient * appclient, char const * app); +static int _connect_addr(String const * service, uint32_t * addr); AppClient * appclient_new_event(char const * app, Event * event) { @@ -229,7 +230,7 @@ AppClient * appclient_new_event(char const * app, Event * event) #endif if((appclient = object_new(sizeof(AppClient))) == NULL) return NULL; - if((appclient->interface = appinterface_new("Session")) == NULL) + if((appclient->interface = appinterface_new("Init")) == NULL) { object_delete(appclient); return NULL; @@ -253,7 +254,6 @@ AppClient * appclient_new_event(char const * app, Event * event) return appclient; } -static int _connect_addr(String const * service, uint32_t * addr); static int _new_connect(AppClient * appclient, char const * app) { struct sockaddr_in sa; @@ -263,10 +263,10 @@ static int _new_connect(AppClient * appclient, char const * app) return 1; sa.sin_family = AF_INET; sa.sin_port = htons(appinterface_get_port(appclient->interface)); - if(_connect_addr("Session", &sa.sin_addr.s_addr) != 0) + if(_connect_addr("Init", &sa.sin_addr.s_addr) != 0) return 1; if(connect(appclient->fd, (struct sockaddr *)&sa, sizeof(sa)) != 0) - return error_set_code(1, "%s%s", "Session: ", strerror(errno)); + return error_set_code(1, "%s%s", "Init: ", strerror(errno)); #ifdef DEBUG fprintf(stderr, "DEBUG: connect(%d, %s:%d) => 0\n", appclient->fd, inet_ntoa(sa.sin_addr), ntohs(sa.sin_port)); @@ -277,7 +277,7 @@ static int _new_connect(AppClient * appclient, char const * app) return error_set_code(1, "%s", _appclient_error_ssl()); SSL_set_connect_state(appclient->ssl); #endif - if(appclient_call(appclient, &port, "port", app) != 0) + if(appclient_call(appclient, &port, "init_get_session", app) != 0) return 1; if(port < 0) return error_set_code(1, "%s", "Could not obtain remote port"); diff --git a/src/appinterface.c b/src/appinterface.c index 0a968a2..db8ce20 100644 --- a/src/appinterface.c +++ b/src/appinterface.c @@ -239,7 +239,7 @@ static void _append_arg(AppInterfaceCallArg * arg, AppInterfaceCallType type, arg->direction = direction; arg->size = _aict_size[type]; #ifdef DEBUG - fprintf(stderr, "DEBUG: type %s, direction: %d, size: %d\n", + fprintf(stderr, "DEBUG: type %s, direction: %d, size: %zu\n", AICTString[type], direction, arg->size); #endif } @@ -248,8 +248,14 @@ static int _new_init(AppInterface * ai) { int ret = 0; - ret |= _new_append(ai, AICT_UINT16, "init_register", 1, AICT_STRING, + ret |= _new_append(ai, AICT_UINT16, "init_login", 1, AICT_STRING); + ret |= _new_append(ai, AICT_UINT16, "init_logout", 0); + ret |= _new_append(ai, AICT_UINT16, "init_register", 2, AICT_STRING, AICT_INT16); + ret |= _new_append(ai, AICT_UINT16, "init_get_session", 1, AICT_STRING); + ret |= _new_append(ai, AICT_UINT16, "init_get_profile", 1, + AICT_STRING | AICD_OUT); + ret |= _new_append(ai, AICT_UINT16, "init_set_profile", 1, AICT_STRING); return ret; } @@ -257,6 +263,7 @@ static int _new_session(AppInterface * ai) { int ret = 0; + /* FIXME re-factor: session_register() etc */ ret |= _new_append(ai, AICT_UINT16, "port", 1, AICT_STRING); ret |= _new_append(ai, AICT_VOID, "list", 0); ret |= _new_append(ai, AICT_BOOL, "start", 1, AICT_STRING); diff --git a/src/appserver.c b/src/appserver.c index 805569a..56819a8 100644 --- a/src/appserver.c +++ b/src/appserver.c @@ -129,7 +129,7 @@ static AppServerClient * _appserverclient_new(int fd, uint32_t addr, { AppServerClient * asc; - if((asc = object_new(sizeof(AppServerClient))) == NULL) + if((asc = object_new(sizeof(*asc))) == NULL) return NULL; asc->state = ASCS_NEW; asc->addr = addr; @@ -225,6 +225,9 @@ static int _appserver_accept(int fd, AppServer * appserver) #endif )) == NULL) { +#ifdef DEBUG + error_print("DEBUG"); +#endif close(newfd); return 0; }