3 /// Common things needed for both client and server
7 Copyright (C) 2010-2012, Net Direct Inc. (http://www.netdirect.ca/)
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
18 See the GNU General Public License in the COPYING file at the
19 root directory of this project for more details.
22 #ifndef __BARRYDESKTOP_IPC_H__
23 #define __BARRYDESKTOP_IPC_H__
27 #define SERVER_SERVICE_NAME _T("/tmp/bsyncjail.socket")
30 #define TOPIC_STATUS _T("Status")
31 #define TOPIC_CONFLICT _T("Conflict")
34 #define STATUS_ITEM_ERROR _T("Error")
35 #define STATUS_ITEM_ENGINE _T("Engine")
36 #define STATUS_ITEM_MAPPING _T("Mapping")
37 #define STATUS_ITEM_ENTRY _T("Entry")
38 #define STATUS_ITEM_MEMBER _T("Member")
40 // Special engine messages
41 #define ENGINE_STATUS_SLOW_SYNC _T("SLOW_SYNC: on")
44 #define CONFLICT_ITEM_START _T("Start")
45 #define CONFLICT_ITEM_CHANGE _T("Change")
46 #define CONFLICT_ITEM_ANSWER _T("Answer")
48 // Used to convert const char* strings into temporary writable
49 // buffers, since wxConnection is not very const correct.
58 : m_buf( new wxChar
[100] )
69 int size() const { return m_data_size
; }
70 wxChar
* buf() { return m_buf
; }
74 if( len
+1 > m_size
) {
77 m_buf
= new wxChar
[len
+1];
83 SillyBuffer
& sbuf(const wxString
&str
) { buf(str
); return *this; }
84 SillyBuffer
& sbuf(const char *str
) { buf(str
); return *this; }
85 SillyBuffer
& sbuf(const std::string
&str
) { buf(str
); return *this; }
87 wxChar
* buf(const wxString
&str
)
90 memcpy(m_buf
, str
.GetData(), str
.Len() * sizeof(wxChar
));
92 m_data_size
= str
.Len();
96 wxChar
* buf(const char *str
)
98 return buf(wxString(str
, wxConvUTF8
));
101 wxChar
* buf(const std::string
&str
)
103 return buf(wxString(str
.c_str(), wxConvUTF8
, str
.size()));
107 extern SillyBuffer sb
;