--- a/project_files/frontlib/ipc/mapconn.c Fri Jun 15 19:57:25 2012 +0200
+++ b/project_files/frontlib/ipc/mapconn.c Tue Jun 19 21:17:05 2012 +0200
@@ -1,5 +1,5 @@
#include "mapconn.h"
-#include "ipcconn.h"
+#include "ipcbase.h"
#include "ipcprotocol.h"
#include "../util/logging.h"
@@ -15,8 +15,8 @@
} mapconn_state;
struct _flib_mapconn {
- uint8_t mapBuffer[IPCCONN_MAPMSG_BYTES];
- flib_ipcconn *connection;
+ uint8_t mapBuffer[IPCBASE_MAPMSG_BYTES];
+ flib_ipcbase *ipcBase;
flib_vector *configBuffer;
mapconn_state progress;
@@ -60,9 +60,9 @@
flib_mapconn *result = NULL;
flib_mapconn *tempConn = flib_calloc(1, sizeof(flib_mapconn));
if(tempConn) {
- tempConn->connection = flib_ipcconn_create();
+ tempConn->ipcBase = flib_ipcbase_create();
tempConn->configBuffer = createConfigBuffer(seed, mapdesc);
- if(tempConn->connection && tempConn->configBuffer) {
+ if(tempConn->ipcBase && tempConn->configBuffer) {
tempConn->progress = AWAIT_CONNECTION;
clearCallbacks(tempConn);
result = tempConn;
@@ -84,7 +84,7 @@
clearCallbacks(conn);
conn->destroyRequested = true;
} else {
- flib_ipcconn_destroy(conn->connection);
+ flib_ipcbase_destroy(conn->ipcBase);
flib_vector_destroy(conn->configBuffer);
free(conn);
}
@@ -96,7 +96,7 @@
flib_log_e("null parameter in flib_mapconn_getport");
return 0;
} else {
- return flib_ipcconn_port(conn->connection);
+ return flib_ipcbase_port(conn->ipcBase);
}
}
@@ -120,12 +120,12 @@
static void flib_mapconn_wrappedtick(flib_mapconn *conn) {
if(conn->progress == AWAIT_CONNECTION) {
- flib_ipcconn_accept(conn->connection);
- switch(flib_ipcconn_state(conn->connection)) {
+ flib_ipcbase_accept(conn->ipcBase);
+ switch(flib_ipcbase_state(conn->ipcBase)) {
case IPC_CONNECTED:
{
flib_constbuffer configBuffer = flib_vector_as_constbuffer(conn->configBuffer);
- if(flib_ipcconn_send_raw(conn->connection, configBuffer.data, configBuffer.size)) {
+ if(flib_ipcbase_send_raw(conn->ipcBase, configBuffer.data, configBuffer.size)) {
conn->progress = FINISHED;
conn->onFailureCb(conn->onFailureCtx, "Error sending map information to the engine.");
return;
@@ -144,11 +144,11 @@
}
if(conn->progress == AWAIT_REPLY) {
- if(flib_ipcconn_recv_map(conn->connection, conn->mapBuffer) >= 0) {
+ if(flib_ipcbase_recv_map(conn->ipcBase, conn->mapBuffer) >= 0) {
conn->progress = FINISHED;
- conn->onSuccessCb(conn->onSuccessCtx, conn->mapBuffer, conn->mapBuffer[IPCCONN_MAPMSG_BYTES-1]);
+ conn->onSuccessCb(conn->onSuccessCtx, conn->mapBuffer, conn->mapBuffer[IPCBASE_MAPMSG_BYTES-1]);
return;
- } else if(flib_ipcconn_state(conn->connection) != IPC_CONNECTED) {
+ } else if(flib_ipcbase_state(conn->ipcBase) != IPC_CONNECTED) {
conn->progress = FINISHED;
conn->onFailureCb(conn->onSuccessCtx, "Engine connection closed unexpectedly.");
return;