From 70bfc74e54ac8a9a93885710cd8350d1a58b3406 Mon Sep 17 00:00:00 2001 From: Ralf Habacker Date: Sat, 3 Mar 2007 17:25:54 +0000 Subject: * dbus/*-win.*,bus/*-win.*: added win32 platform related files. These files are only added to the cmake build system. The missing dbus-win32.patch file will be added later. --- dbus/dbus-sysdeps-win.h | 174 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 174 insertions(+) create mode 100644 dbus/dbus-sysdeps-win.h (limited to 'dbus/dbus-sysdeps-win.h') diff --git a/dbus/dbus-sysdeps-win.h b/dbus/dbus-sysdeps-win.h new file mode 100644 index 00000000..2bfb2a31 --- /dev/null +++ b/dbus/dbus-sysdeps-win.h @@ -0,0 +1,174 @@ +/* -*- mode: C; c-file-style: "gnu" -*- */ +/* dbus-sysdeps.c Wrappers around system/libc features (internal to D-BUS implementation) + * + * Copyright (C) 2002, 2003 Red Hat, Inc. + * Copyright (C) 2003 CodeFactory AB + * Copyright (C) 2005 Novell, Inc. + * + * Licensed under the Academic Free License version 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef DBUS_SYSDEPS_WIN_H +#define DBUS_SYSDEPS_WIN_H + +#define _WINSOCKAPI_ + +#include "dbus-hash.h" +#include "dbus-string.h" +#include +#include +#include + +#include +#include +#include +#include +#include + +#define mkdir(path, mode) _mkdir (path) + +#ifndef DBUS_WINCE +#ifndef S_ISREG +#define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif +#endif + +/* Declarations missing in mingw's headers */ +extern BOOL WINAPI ConvertStringSidToSidA (LPCSTR StringSid, PSID *Sid); +extern BOOL WINAPI ConvertSidToStringSidA (PSID Sid, LPSTR *StringSid); + + +#define DBUS_CONSOLE_DIR "/var/run/console/" + +typedef struct + { + int fd; /* File descriptor, SOCKET or file HANDLE */ + int port_file_fd; /* File descriptor for file containing + * port number for "pseudo-unix" sockets + */ + DBusString port_file; /* File name for said file */ + dbus_bool_t close_on_exec; + dbus_bool_t non_blocking; + int is_used; + } +DBusSocket; + +extern DBusSocket *win_fds; +extern int win32_n_fds; + + +void _dbus_win_startup_winsock (void); +void _dbus_win_warn_win_error (const char *message, + int code); +extern const char* _dbus_lm_strerror (int error_number); + + +dbus_bool_t +fill_win_user_info_from_uid (dbus_uid_t uid, + DBusUserInfo *info, + DBusError *error); +dbus_bool_t +fill_win_user_info_from_name (wchar_t *wname, + DBusUserInfo *info, + DBusError *error); + +dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount, + void **ppsid, + DBusError *error); + +dbus_bool_t +_dbus_win32_sid_to_name_and_domain (dbus_uid_t uid, + wchar_t **wname, + wchar_t **wdomain, + DBusError *error); + + +/* Don't define DBUS_CONSOLE_DIR on Win32 */ + +wchar_t *_dbus_win_utf8_to_utf16 (const char *str, + DBusError *error); +char *_dbus_win_utf16_to_utf8 (const wchar_t *str, + DBusError *error); + +void _dbus_win_set_error_from_win_error (DBusError *error, int code); + +dbus_uid_t _dbus_win_sid_to_uid_t (void *psid); +dbus_bool_t _dbus_uid_t_to_win_sid (dbus_uid_t uid, + void **ppsid); +dbus_bool_t +_dbus_account_to_win_sid (const wchar_t *waccount, + void **ppsid, + DBusError *error); +dbus_bool_t +_dbus_win_sid_to_name_and_domain (dbus_uid_t uid, + wchar_t **wname, + wchar_t **wdomain, + DBusError *error); + +typedef struct DBusFile DBusFile; + +dbus_bool_t _dbus_open_file (DBusFile *file, + const char *filename, + int oflag, + int pmode); + +dbus_bool_t _dbus_close_file (DBusFile *file, + DBusError *error); + + +int _dbus_read_file (DBusFile *file, + DBusString *buffer, + int count); + +int _dbus_write_file (DBusFile *file, + const DBusString *buffer, + int start, + int len); + +#define FDATA private_data +struct DBusFile + { + int FDATA; + }; + + +void _dbus_handle_to_socket (int handle, + DBusSocket **socket); +int _dbus_socket_to_handle (DBusSocket *socket); + +dbus_bool_t +fill_user_info (DBusUserInfo *info, + dbus_uid_t uid, + const DBusString *username, + DBusError *error); + +// replace with a windows version +dbus_bool_t _dbus_open_unix_socket (int *fd, + DBusError *error); +int _dbus_connect_unix_socket (const char *path, + dbus_bool_t abstract, + DBusError *error); +int _dbus_listen_unix_socket (const char *path, + dbus_bool_t abstract, + DBusError *error); + +#endif + +/** @} end of sysdeps-win.h */ + + -- cgit