Commit 70bfc74e authored by Ralf Habacker's avatar Ralf Habacker

* 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.
parent 36ebfd41
2007-03-03 Ralf Habacker <ralf.habacker@freenet.de>
* 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.
2007-03-03 Ralf Habacker <ralf.habacker@freenet.de>
* cmake: new directory, contains cmake build support.
......
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-sockets.h Wrappers around socket features (internal to D-BUS implementation)
*
* 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_SOCKETS_H
#define DBUS_SOCKETS_H
#if defined(DBUS_WIN) || defined(DBUS_WINCE)
#ifndef STRICT
#define STRICT
#include <winsock2.h>
#undef STRICT
#endif
#include <winsock2.h>
#undef interface
#include <errno.h>
/* Make use of the fact that the WSAE* error codes don't
* overlap with errno E* codes. Wrapper functions store
* the return value from WSAGetLastError() in errno.
*/
#if defined(EPROTONOSUPPORT) || \
defined(EAFNOSUPPORT) || \
defined(EWOULDBLOCK)
#error This does not look like Win32 and the Microsoft C library
#endif
#define EPROTONOSUPPORT WSAEPROTONOSUPPORT
#define EAFNOSUPPORT WSAEAFNOSUPPORT
#define EWOULDBLOCK WSAEWOULDBLOCK
#define DBUS_SOCKET_IS_INVALID(s) ((SOCKET)(s) == INVALID_SOCKET)
#define DBUS_SOCKET_API_RETURNS_ERROR(n) ((n) == SOCKET_ERROR)
#define DBUS_SOCKET_SET_ERRNO() errno = WSAGetLastError()
#define DBUS_CLOSE_SOCKET(s) closesocket(s)
#else
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#include <netdb.h>
#include <errno.h>
#define DBUS_SOCKET_IS_INVALID(s) ((s) < 0)
#define DBUS_SOCKET_API_RETURNS_ERROR(n) ((n) < 0)
#define DBUS_SOCKET_SET_ERRNO() /* empty */
#define DBUS_CLOSE_SOCKET(s) close(s)
#endif /* !Win32 */
#endif /* DBUS_SOCKETS_H */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/* -*- 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 <ctype.h>
#include <malloc.h>
#include <windows.h>
#include <aclapi.h>
#include <lm.h>
#include <io.h>
#include <share.h>
#include <direct.h>
#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 */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment