Jorge has submitted a good start on ecore_dbus... :)

SVN revision: 14472
This commit is contained in:
Carsten Haitzler 2005-04-29 05:29:29 +00:00
parent 5b1003cb54
commit a30276b663
8 changed files with 1594 additions and 1 deletions

View File

@ -13,3 +13,4 @@ Andrew Elcock <andy@elcock.org>
Kim Woelders <kim@woelders.dk>
Sebastian Dransfeld <sebastid@tango.flipp.net>
Simon Poole <simon.armlinux@themalago.net>
Jorge Luis Zapata Muga <jorgeluis.zapata@gmail.com>

View File

@ -697,6 +697,55 @@ AC_SUBST(ecore_ipc_cflags)
AC_SUBST(ecore_ipc_libs)
AC_MSG_CHECKING(whether ecore_dbus module is to be built)
have_ecore_dbus="no";
ecore_dbus_cflags="";
ecore_dbus_libs="";
dbus_dir="";
dbus_includes="";
dbus_cflags="";
dbus_libs="";
AC_ARG_ENABLE(ecore-con,
[ --disable-ecore-dbus disable the ecore_dbus module], [
if [ test "$enableval" = "yes" ]; then
AC_MSG_RESULT(yes)
have_ecore_dbus="yes"
else
AC_MSG_RESULT(no)
fi
], [
AC_MSG_RESULT(yes)
have_ecore_dbus="yes"
]
)
if test "x$have_ecore_dbus" = "xyes"; then
AM_CONDITIONAL(BUILD_ECORE_DBUS, true)
AC_DEFINE(BUILD_ECORE_DBUS, 1, [Build Ecore_DBus Module])
BUILD_ECORE_DBUS=1
#dbus_dir="/usr";
#dbus_includes="";
#dbus_cflags="-I"$dbus_dir"/include/dbus-1.0 -I"$dbus_dir"/lib/dbus-1.0/include"
#dbus_libs="-L"$dbus_dir"/lib"
#dbus_ldflags="-ldbus-1";
ecore_dbus_libs="-lecore_dbus";
else
AM_CONDITIONAL(BUILD_ECORE_DBUS, false)
BUILD_ECORE_DBUS=0
fi
AC_SUBST(BUILD_ECORE_DBUS)
AC_SUBST(dbus_cflags)
AC_SUBST(dbus_includes)
AC_SUBST(dbus_ldflags)
AC_SUBST(dbus_libs)
AC_SUBST(ecore_dbus_cflags)
AC_SUBST(ecore_dbus_libs)
AC_MSG_CHECKING(whether ecore_config module is to be built)
have_ecore_config="no";
@ -916,6 +965,7 @@ src/lib/ecore_ipc/Makefile
src/lib/ecore_txt/Makefile
src/lib/ecore_config/Makefile
src/lib/ecore_file/Makefile
src/lib/ecore_dbus/Makefile
examples/Makefile
ecore-config
README
@ -945,6 +995,7 @@ echo " Ecore_Evas FB Support...: $have_ecore_evas_fb"
echo " Ecore_Buffer............: $have_ecore_evas_buffer"
echo " Ecore_Ipc...............: $have_ecore_ipc (OpenSSL: $use_openssl)"
echo " Ecore_Config............: $have_ecore_config"
echo " Ecore_DBUS..............: $have_ecore_dbus"
#echo " Ecore_File..............: $have_ecore_file (Inotify: $use_inotify) (FAM: $use_fam) (Poll: $use_poll)"
echo " Ecore_File..............: $have_ecore_file (Inotify: $use_inotify) (Poll: $use_poll)"
echo

View File

@ -9,4 +9,5 @@ ecore_x \
ecore_ipc \
ecore_evas \
ecore_config \
ecore_file
ecore_file \
ecore_dbus

View File

@ -0,0 +1,7 @@
.deps
.libs
Ecore_Con.h
Makefile
Makefile.in
ecore_con.lo
libecore_con.la

View File

@ -0,0 +1,209 @@
#ifndef _ECORE_DBUS_H
#define _ECORE_DBUS_H
#endif
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else
# define EAPI __declspec(dllimport)
# endif
#else
# ifdef GCC_HASCLASSVISIBILITY
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
# endif
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct _Ecore_DBus_Server Ecore_DBus_Server;
typedef struct _Ecore_DBus_Client Ecore_DBus_Client;
typedef struct _Ecore_DBus_Event_Server_Add Ecore_DBus_Event_Server_Add;
typedef struct _Ecore_DBus_Event_Server_Del Ecore_DBus_Event_Server_Del;
typedef struct _Ecore_DBus_Event_Server_Data Ecore_DBus_Event_Server_Data;
typedef struct _Ecore_DBus_Message Ecore_DBus_Message;
typedef struct _Ecore_DBus_Message_Field Ecore_DBus_Message_Field;
typedef struct _Ecore_DBus_Auth Ecore_DBus_Auth;
typedef unsigned char* (*Ecore_DBus_Auth_Transaction)(void*);
typedef enum _Ecore_DBus_Type
{
ECORE_DBUS_BUS_SESSION,
ECORE_DBUS_BUS_SYSTEM,
ECORE_DBUS_BUS_ACTIVATION
} Ecore_DBus_Type;
typedef enum _Ecore_DBus_Message_Type
{
ECORE_DBUS_MESSAGE_TYPE_INVALID,
ECORE_DBUS_MESSAGE_TYPE_METHOD_CALL,
ECORE_DBUS_MESSAGE_TYPE_METHOD_RETURN,
ECORE_DBUS_MESSAGE_TYPE_ERROR,
ECORE_DBUS_MESSAGE_TYPE_SIGNAL
} Ecore_DBus_Message_Type;
/* message data types */
typedef enum _Ecore_DBus_Data_Type
{
ECORE_DBUS_DATA_TYPE_INVALID = ((int) '\0'),
ECORE_DBUS_DATA_TYPE_NIL = ((int) '\0'),
ECORE_DBUS_DATA_TYPE_BYTE = ((int) 'y'),
ECORE_DBUS_DATA_TYPE_BOOLEAN = ((int) 'b'), /* 0,1 */
ECORE_DBUS_DATA_TYPE_INT32 = ((int) 'i'),
ECORE_DBUS_DATA_TYPE_UINT32 =((int) 'u'),
ECORE_DBUS_DATA_TYPE_INT64 = ((int) 'x'),
ECORE_DBUS_DATA_TYPE_UINT64 = ((int) 't'),
ECORE_DBUS_DATA_TYPE_DOUBLE = ((int) 'd'),
ECORE_DBUS_DATA_TYPE_STRING = ((int) 's'),
ECORE_DBUS_DATA_TYPE_CUSTOM = ((int) 'c'),
ECORE_DBUS_DATA_TYPE_ARRAY =((int) 'a'),
ECORE_DBUS_DATA_TYPE_DICT = ((int) 'm'),
ECORE_DBUS_DATA_TYPE_OBJECT_PATH = ((int) 'o')
} Ecore_DBus_Data_Type;
typedef enum _Ecore_DBus_Message_Header_Field
{
ECORE_DBUS_HEADER_FIELD_INVALID,
ECORE_DBUS_HEADER_FIELD_PATH,
ECORE_DBUS_HEADER_FIELD_INTERFACE,
ECORE_DBUS_HEADER_FIELD_MEMBER,
ECORE_DBUS_HEADER_FIELD_ERROR_NAME,
ECORE_DBUS_HEADER_FIELD_REPLY_SERIAL,
ECORE_DBUS_HEADER_FIELD_DESTINATION,
ECORE_DBUS_HEADER_FIELD_SENDER,
ECORE_DBUS_HEADER_FIELD_SIGNATURE
} Ecore_DBus_Message_Header_Field;
typedef enum _Ecore_DBus_Auth_Type
{
ECORE_DBUS_AUTH_TYPE_EXTERNAL,
ECORE_DBUS_AUTH_MAGIC_COOKIE,
ECORE_DBUS_AUTH_TYPE_DBUS_COOKIE_SHA1,
ECORE_DBUS_AUTH_TYPE_KERBEROS_V4,
ECORE_DBUS_AUTH_TYPE_SKEY
} Ecore_DBus_Auth_Type;
struct _Ecore_DBus_Auth
{
unsigned char *name;
unsigned int num_transactions;
Ecore_DBus_Auth_Transaction transactions[5];
};
struct _Ecore_DBus_Event_Server_Add
{
Ecore_DBus_Server *server;
};
struct _Ecore_DBus_Event_Server_Del
{
Ecore_DBus_Server *server;
};
struct _Ecore_DBus_Message_Field
{
Ecore_List __list_data;
Ecore_DBus_Data_Type type;
unsigned int offset;
unsigned int count; /* number of elements, usefull for structs, arrays, dicts */
unsigned int hfield; /* if the field is a header field, we need the type of it */
};
struct _Ecore_DBus_Message
{
/* header fields */
unsigned char byte_order;
unsigned char type;
unsigned char flags;
unsigned char protocol;
unsigned long hlength;
unsigned long blength;
unsigned long serial;
Ecore_DBus_Server *ref_server;
unsigned char *header;
unsigned int hpos;
Ecore_DBus_Message_Field *header_fields;
unsigned char *body;
unsigned int bpos;
Ecore_DBus_Message_Field *body_fields;
unsigned char *signature;
};
extern int ECORE_DBUS_EVENT_SERVER_ADD;
extern int ECORE_DBUS_EVENT_SERVER_DATA;
/* Message byte order */
#define DBUS_LITTLE_ENDIAN ('l') /* LSB first */
#define DBUS_BIG_ENDIAN ('B') /* MSB first */
/* Protocol version */
#define DBUS_MAJOR_PROTOCOL_VERSION 0
/* Max length in bytes of a service or interface or member name */
#define DBUS_MAXIMUM_NAME_LENGTH 256
/* Max length of a match rule string */
#define DBUS_MAXIMUM_MATCH_RULE_LENGTH 1024
/* Header flags */
#define DBUS_HEADER_FLAG_NO_REPLY_EXPECTED 0x1
#define DBUS_HEADER_FLAG_AUTO_ACTIVATION 0x2
#define DBUS_HEADER_FIELD_LAST DBUS_HEADER_FIELD_SIGNATURE
/* Services */
#define DBUS_SERVICE_ORG_FREEDESKTOP_DBUS "org.freedesktop.DBus"
/* Paths */
#define DBUS_PATH_ORG_FREEDESKTOP_DBUS "/org/freedesktop/DBus"
#define DBUS_PATH_ORG_FREEDESKTOP_LOCAL "/org/freedesktop/Local"
/* Interfaces, these #define don't do much other than
* * catch typos at compile time
* */
#define DBUS_INTERFACE_ORG_FREEDESKTOP_DBUS "org.freedesktop.DBus"
#define DBUS_INTERFACE_ORG_FREEDESKTOP_INTROSPECTABLE "org.freedesktop.Introspectable"
/* This is a special interface whose methods can only be invoked
* by the local implementation (messages from remote apps aren't
* allowed to specify this interface).
*/
#define DBUS_INTERFACE_ORG_FREEDESKTOP_LOCAL "org.freedesktop.Local"
/* Service owner flags */
#define DBUS_SERVICE_FLAG_PROHIBIT_REPLACEMENT 0x1
#define DBUS_SERVICE_FLAG_REPLACE_EXISTING 0x2
/* Service replies */
#define DBUS_SERVICE_REPLY_PRIMARY_OWNER 0x1
#define DBUS_SERVICE_REPLY_IN_QUEUE 0x2
#define DBUS_SERVICE_REPLY_SERVICE_EXISTS 0x4
#define DBUS_SERVICE_REPLY_ALREADY_OWNER 0x8
/* Activation replies */
#define DBUS_ACTIVATION_REPLY_ACTIVATED 0x0
#define DBUS_ACTIVATION_REPLY_ALREADY_ACTIVE 0x1
/* connection */
EAPI int ecore_dbus_init(void);
EAPI Ecore_DBus_Server* ecore_dbus_server_connect(Ecore_DBus_Type compl_type, char *name, int port, const void *data);
/* message */
EAPI unsigned int ecore_dbus_message_new_method_call(Ecore_DBus_Server *svr,char *service,char *path,char *interface,char *method,char *fmt, ...);
EAPI void ecore_dbus_message_print(Ecore_DBus_Message *msg);
EAPI void * ecore_dbus_get_header_field(Ecore_DBus_Message *,Ecore_DBus_Message_Field *, Ecore_DBus_Message_Header_Field);
EAPI void * ecore_dbus_get_body_field(Ecore_DBus_Message *,Ecore_DBus_Message_Field *, unsigned int);
#ifdef __cplusplus
}
#endif

View File

@ -0,0 +1,33 @@
## Process this file with automake to produce Makefile.in
INCLUDES = \
-I$(top_builddir)/src/lib/ecore \
-I$(top_builddir)/src/lib/ecore_con \
-I$(top_srcdir)/src/lib/ecore \
-I$(top_srcdir)/src/lib/ecore_con \
@SSL_CFLAGS@
libecore_con_la_LDFLAGS = -version-info 1:0:0 \
-L$(top_builddir)/src/lib/ecore/.libs
if BUILD_ECORE_DBUS
lib_LTLIBRARIES = libecore_con.la
include_HEADERS = \
Ecore_DBus.h
libecore_con_la_SOURCES = \
ecore_dbus.c \
ecore_dbus_private.h
libecore_con_la_LIBADD = \
$(top_builddir)/src/lib/ecore/libecore.la
libecore_con_la_DEPENDENCIES = \
$(top_builddir)/src/lib/ecore/libecore.la
endif
EXTRA_DIST = \
ecore_dbus.c \
ecore_dbus_private.h

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,56 @@
#ifndef _ECORE_DBUS_PRIVATE_H
#define _ECORE_DBUS_PRIVATE_H
struct _Ecore_DBus_Client
{
Ecore_DBus_Client *client;
};
struct _Ecore_DBus_Server
{
Ecore_List __list_data;
Ecore_Con_Server *server;
Ecore_DBus_Client *clients;
/* unsigned char *buf; */
/* int buf_size; */
unsigned int cnt_msg;
Ecore_List *msg_queue;
/* void *data;*/
unsigned int authenticated;
int auth_type;
unsigned int auth_type_transaction;
};
/* Errors */
/* WARNING dont change order or ABI breaks. */
#define DBUS_ERROR_FAILED "org.freedesktop.DBus.Error.Failed"
#define DBUS_ERROR_NO_MEMORY "org.freedesktop.DBus.Error.NoMemory"
#define DBUS_ERROR_ACTIVATE_SERVICE_NOT_FOUND "org.freedesktop.DBus.Error.ServiceNotFound"
#define DBUS_ERROR_SERVICE_DOES_NOT_EXIST "org.freedesktop.DBus.Error.ServiceDoesNotExist"
#define DBUS_ERROR_SERVICE_HAS_NO_OWNER "org.freedesktop.DBus.Error.ServiceHasNoOwner"
#define DBUS_ERROR_NO_REPLY "org.freedesktop.DBus.Error.NoReply"
#define DBUS_ERROR_IO_ERROR "org.freedesktop.DBus.Error.IOError"
#define DBUS_ERROR_BAD_ADDRESS "org.freedesktop.DBus.Error.BadAddress"
#define DBUS_ERROR_NOT_SUPPORTED "org.freedesktop.DBus.Error.NotSupported"
#define DBUS_ERROR_LIMITS_EXCEEDED "org.freedesktop.DBus.Error.LimitsExceeded"
#define DBUS_ERROR_ACCESS_DENIED "org.freedesktop.DBus.Error.AccessDenied"
#define DBUS_ERROR_AUTH_FAILED "org.freedesktop.DBus.Error.AuthFailed"
#define DBUS_ERROR_NO_SERVER "org.freedesktop.DBus.Error.NoServer"
#define DBUS_ERROR_TIMEOUT "org.freedesktop.DBus.Error.Timeout"
#define DBUS_ERROR_NO_NETWORK "org.freedesktop.DBus.Error.NoNetwork"
#define DBUS_ERROR_ADDRESS_IN_USE "org.freedesktop.DBus.Error.AddressInUse"
#define DBUS_ERROR_DISCONNECTED "org.freedesktop.DBus.Error.Disconnected"
#define DBUS_ERROR_INVALID_ARGS "org.freedesktop.DBus.Error.InvalidArgs"
#define DBUS_ERROR_FILE_NOT_FOUND "org.freedesktop.DBus.Error.FileNotFound"
#define DBUS_ERROR_UNKNOWN_METHOD "org.freedesktop.DBus.Error.UnknownMethod"
#define DBUS_ERROR_TIMED_OUT "org.freedesktop.DBus.Error.TimedOut"
#define DBUS_ERROR_MATCH_RULE_NOT_FOUND "org.freedesktop.DBus.Error.MatchRuleNotFound"
#define DBUS_ERROR_MATCH_RULE_INVALID "org.freedesktop.DBus.Error.MatchRuleInvalid"
#define DBUS_ERROR_SPAWN_EXEC_FAILED "org.freedesktop.DBus.Error.Spawn.ExecFailed"
#define DBUS_ERROR_SPAWN_FORK_FAILED "org.freedesktop.DBus.Error.Spawn.ForkFailed"
#define DBUS_ERROR_SPAWN_CHILD_EXITED "org.freedesktop.DBus.Error.Spawn.ChildExited"
#define DBUS_ERROR_SPAWN_CHILD_SIGNALED "org.freedesktop.DBus.Error.Spawn.ChildSignaled"
#define DBUS_ERROR_SPAWN_FAILED "org.freedesktop.DBus.Error.Spawn.Failed"
#define DBUS_ERROR_UNIX_PROCESS_ID_UNKNOWN "org.freedesktop.DBus.Error.UnixProcessIdUnknown"
#endif