• Main Page
  • Related Pages
  • Modules
  • Data Structures
  • Files
  • File List

osengine/osengine_status.c

00001 /*
00002  * libosengine - A synchronization engine for the opensync framework
00003  * Copyright (C) 2004-2005  Armin Bauer <armin.bauer@opensync.org>
00004  * 
00005  * This library is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU Lesser General Public
00007  * License as published by the Free Software Foundation; either
00008  * version 2.1 of the License, or (at your option) any later version.
00009  * 
00010  * This library is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013  * Lesser General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU Lesser General Public
00016  * License along with this library; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00018  * 
00019  */
00020  
00021 #include "engine.h"
00022 #include "engine_internals.h"
00023 
00024 void osync_status_conflict(OSyncEngine *engine, OSyncMapping *mapping)
00025 {
00026         osync_trace(TRACE_ENTRY, "%s(%p, %p)", __func__, engine, mapping);
00027         if (engine->conflict_callback)
00028                 engine->conflict_callback(engine, mapping, engine->conflict_userdata);
00029         else
00030                 osync_trace(TRACE_INTERNAL, "Conflict Ignored");
00031                 
00032         osync_trace(TRACE_EXIT, "%s", __func__);
00033 }
00034 
00035 void osync_status_update_member(OSyncEngine *engine, OSyncClient *client, memberupdatetype type, OSyncError **error)
00036 {
00037         osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p)", __func__, engine, client, type, error);
00038         if (engine->mebstat_callback) {
00039                 OSyncMemberUpdate update;
00040                 memset(&update, 0, sizeof(OSyncMemberUpdate));
00041                 update.type = type;
00042                 update.member = client->member;
00043                 if (error)
00044                         update.error = *error;
00045                 else
00046                         update.error = NULL;
00047                 engine->mebstat_callback(&update, engine->mebstat_userdata);
00048         } else
00049                 osync_trace(TRACE_INTERNAL, "Status Update Ignored");
00050                 
00051         osync_trace(TRACE_EXIT, "%s", __func__);
00052 }
00053 
00054 void osync_status_update_change(OSyncEngine *engine, OSyncChange *change, changeupdatetype type, OSyncError **error)
00055 {
00056         osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p)", __func__, engine, change, type, error);
00057         if (engine->changestat_callback) {
00058                 OSyncChangeUpdate update;
00059                 update.type = type;
00060                 update.member_id = osync_member_get_id(osync_change_get_member(change));
00061                 update.change = change;
00062                 update.mapping_id = osync_change_get_mappingid(change);
00063                 if (error)
00064                         update.error = *error;
00065                 else
00066                         update.error = NULL;
00067                 engine->changestat_callback(engine, &update, engine->changestat_userdata);
00068         } else
00069                 osync_trace(TRACE_INTERNAL, "Status Update Ignored");
00070                 
00071         osync_trace(TRACE_EXIT, "%s", __func__);
00072 }
00073 
00074 void osync_status_update_mapping(OSyncEngine *engine, OSyncMapping *mapping, mappingupdatetype type, OSyncError **error)
00075 {
00076         osync_trace(TRACE_ENTRY, "%s(%p, %p, %i, %p)", __func__, engine, mapping, type, error);
00077         if (engine->mapstat_callback) {
00078                 OSyncMappingUpdate update;
00079                 update.type = type;
00080                 update.mapping = mapping;
00081                 if (mapping->master)
00082                         update.winner = osync_member_get_id(mapping->master->client->member);
00083                 if (error)
00084                         update.error = *error;
00085                 else
00086                         update.error = NULL;
00087                 engine->mapstat_callback(&update, engine->mapstat_userdata);
00088         } else
00089                 osync_trace(TRACE_INTERNAL, "Status Update Ignored");
00090                 
00091         osync_trace(TRACE_EXIT, "%s", __func__);
00092 }
00093 
00094 void osync_status_update_engine(OSyncEngine *engine, engineupdatetype type, OSyncError **error)
00095 {
00096         osync_trace(TRACE_ENTRY, "%s(%p, %i, %p)", __func__, engine, type, error);
00097         if (engine->engstat_callback) {
00098                 OSyncEngineUpdate update;
00099                 memset(&update, 0, sizeof(OSyncEngineUpdate));
00100                 update.type = type;
00101                 if (error)
00102                         update.error = *error;
00103                 else
00104                         update.error = NULL;
00105                 engine->engstat_callback(engine, &update, engine->engstat_userdata);
00106         } else
00107                 osync_trace(TRACE_INTERNAL, "Status Update Ignored");
00108                 
00109         osync_trace(TRACE_EXIT, "%s", __func__);
00110 }

Generated on Mon Jul 26 2010 for OpenSync by  doxygen 1.7.1