dbus/dbus Makefile.am, 1.88, 1.88.2.1 dbus-connection.c, 1.152.2.1, 1.152.2.2 dbus-connection.h, 1.48, 1.48.2.1 dbus-misc.c, NONE, 1.1.2.1 dbus-misc.h, NONE, 1.1.2.1 dbus-test.c, 1.43, 1.43.2.1 dbus-test.h, 1.32, 1.32.10.1 dbus.h, 1.24, 1.24.2.1

Havoc Pennington hp at kemper.freedesktop.org
Tue Nov 14 19:07:30 PST 2006


Update of /cvs/dbus/dbus/dbus
In directory kemper:/tmp/cvs-serv3586/dbus

Modified Files:
      Tag: DBUS_1_0
	Makefile.am dbus-connection.c dbus-connection.h dbus-test.c 
	dbus-test.h dbus.h 
Added Files:
      Tag: DBUS_1_0
	dbus-misc.c dbus-misc.h 
Log Message:
2006-11-14  Havoc Pennington  <hp at redhat.com>
	
	* dbus/dbus-misc.c, dbus/dbus-misc.h: Move
	dbus_get_local_machine_id() to its own file, no substantive
	changes. There are a couple other things we might want to add that
	are "misc" so moving out of dbus-connection.[hc] which is big
	enough already.
	


Index: Makefile.am
===================================================================
RCS file: /cvs/dbus/dbus/dbus/Makefile.am,v
retrieving revision 1.88
retrieving revision 1.88.2.1
diff -u -d -r1.88 -r1.88.2.1
--- Makefile.am	27 Oct 2006 01:09:24 -0000	1.88
+++ Makefile.am	15 Nov 2006 03:07:28 -0000	1.88.2.1
@@ -17,6 +17,7 @@
 	dbus-macros.h				\
 	dbus-memory.h				\
 	dbus-message.h				\
+	dbus-misc.h				\
 	dbus-pending-call.h			\
 	dbus-protocol.h				\
 	dbus-server.h				\
@@ -54,6 +55,7 @@
 	dbus-message.c				\
 	dbus-message-internal.h			\
 	dbus-message-private.h			\
+	dbus-misc.c				\
 	dbus-object-tree.c			\
 	dbus-object-tree.h			\
 	dbus-pending-call.c			\

Index: dbus-connection.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.c,v
retrieving revision 1.152.2.1
retrieving revision 1.152.2.2
diff -u -d -r1.152.2.1 -r1.152.2.2
--- dbus-connection.c	15 Nov 2006 01:51:19 -0000	1.152.2.1
+++ dbus-connection.c	15 Nov 2006 03:07:28 -0000	1.152.2.2
@@ -5482,61 +5482,4 @@
   return res;
 }
 
-/**
- * Obtains the machine UUID of the machine this process is running on.
- *
- * The returned string must be freed with dbus_free().
- * 
- * This UUID is guaranteed to remain the same until the next reboot
- * (unless the sysadmin foolishly changes it and screws themselves).
- * It will usually remain the same across reboots also, but hardware
- * configuration changes or rebuilding the machine could break that.
- *
- * The idea is that two processes with the same machine ID should be
- * able to use shared memory, UNIX domain sockets, process IDs, and other
- * features of the OS that require both processes to be running
- * on the same OS kernel instance.
- *
- * The machine ID can also be used to create unique per-machine
- * instances. For example, you could use it in bus names or
- * X selection names.
- *
- * The machine ID is preferred over the machine hostname, because
- * the hostname is frequently set to "localhost.localdomain" and
- * may also change at runtime.
- *
- * You can get the machine ID of a remote application by invoking the
- * method GetMachineId from interface org.freedesktop.DBus.Peer.
- *
- * If the remote application has the same machine ID as the one
- * returned by this function, then the remote application is on the
- * same machine as your application.
- *
- * The UUID is not a UUID in the sense of RFC4122; the details
- * are explained in the D-Bus specification.
- *
- * @returns a 32-byte-long hex-encoded UUID string, or #NULL if insufficient memory
- */
-char*
-dbus_get_local_machine_id (void)
-{
-  DBusString uuid;
-  char *s;
-
-  s = NULL;
-  _dbus_string_init (&uuid);
-  if (!_dbus_get_local_machine_uuid_encoded (&uuid) ||
-      !_dbus_string_steal_data (&uuid, &s))
-    {
-      _dbus_string_free (&uuid);
-      return FALSE;
-    }
-  else
-    {
-      _dbus_string_free (&uuid);
-      return s;
-    }
-
-}
-
 /** @} */

Index: dbus-connection.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-connection.h,v
retrieving revision 1.48
retrieving revision 1.48.2.1
diff -u -d -r1.48 -r1.48.2.1
--- dbus-connection.h	21 Oct 2006 23:38:11 -0000	1.48
+++ dbus-connection.h	15 Nov 2006 03:07:28 -0000	1.48.2.1
@@ -321,8 +321,6 @@
 dbus_bool_t dbus_connection_get_socket             (DBusConnection              *connection,
                                                     int                         *fd);
 
-char*       dbus_get_local_machine_id              (void);
-
 /** @} */
 
 

--- NEW FILE: dbus-misc.c ---
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-misc.c  A few assorted public functions that don't fit elsewhere
 *
 * Copyright (C) 2006 Red Hat, 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
 *
 */

#include <config.h>
#include "dbus-misc.h"
#include "dbus-internals.h"
#include "dbus-string.h"

/**
 * @defgroup DBusMisc Miscellaneous
 * @ingroup  DBus
 * @brief Miscellaneous API that doesn't cleanly fit anywhere else
 *
 * @{
 */

/**
 * Obtains the machine UUID of the machine this process is running on.
 *
 * The returned string must be freed with dbus_free().
 * 
 * This UUID is guaranteed to remain the same until the next reboot
 * (unless the sysadmin foolishly changes it and screws themselves).
 * It will usually remain the same across reboots also, but hardware
 * configuration changes or rebuilding the machine could break that.
 *
 * The idea is that two processes with the same machine ID should be
 * able to use shared memory, UNIX domain sockets, process IDs, and other
 * features of the OS that require both processes to be running
 * on the same OS kernel instance.
 *
 * The machine ID can also be used to create unique per-machine
 * instances. For example, you could use it in bus names or
 * X selection names.
 *
 * The machine ID is preferred over the machine hostname, because
 * the hostname is frequently set to "localhost.localdomain" and
 * may also change at runtime.
 *
 * You can get the machine ID of a remote application by invoking the
 * method GetMachineId from interface org.freedesktop.DBus.Peer.
 *
 * If the remote application has the same machine ID as the one
 * returned by this function, then the remote application is on the
 * same machine as your application.
 *
 * The UUID is not a UUID in the sense of RFC4122; the details
 * are explained in the D-Bus specification.
 *
 * @returns a 32-byte-long hex-encoded UUID string, or #NULL if insufficient memory
 */
char*
dbus_get_local_machine_id (void)
{
  DBusString uuid;
  char *s;

  s = NULL;
  _dbus_string_init (&uuid);
  if (!_dbus_get_local_machine_uuid_encoded (&uuid) ||
      !_dbus_string_steal_data (&uuid, &s))
    {
      _dbus_string_free (&uuid);
      return FALSE;
    }
  else
    {
      _dbus_string_free (&uuid);
      return s;
    }

}

/** @} */ /* End of public API */

#ifdef DBUS_BUILD_TESTS

#ifndef DOXYGEN_SHOULD_SKIP_THIS

#include "dbus-test.h"
#include <stdlib.h>


dbus_bool_t
_dbus_misc_test (void)
{
  
  return TRUE;
}

#endif /* !DOXYGEN_SHOULD_SKIP_THIS */

#endif

--- NEW FILE: dbus-misc.h ---
/* -*- mode: C; c-file-style: "gnu" -*- */
/* dbus-misc.h  A few assorted public functions that don't fit elsewhere
 *
 * Copyright (C) 2006 Red Hat, 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
 *
 */
#if !defined (DBUS_INSIDE_DBUS_H) && !defined (DBUS_COMPILATION)
#error "Only <dbus/dbus.h> can be included directly, this file may disappear or change contents."
#endif

#ifndef DBUS_MISC_H
#define DBUS_MISC_H

#include <dbus/dbus-types.h>
#include <dbus/dbus-errors.h>

DBUS_BEGIN_DECLS

/**
 * @addtogroup DBusMisc
 * @{
 */

char*       dbus_get_local_machine_id              (void);

/** @} */

DBUS_END_DECLS

#endif /* DBUS_MISC_H */


Index: dbus-test.c
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-test.c,v
retrieving revision 1.43
retrieving revision 1.43.2.1
diff -u -d -r1.43 -r1.43.2.1
--- dbus-test.c	28 Oct 2006 01:41:37 -0000	1.43
+++ dbus-test.c	15 Nov 2006 03:07:28 -0000	1.43.2.1
@@ -115,6 +115,8 @@
   run_test ("sysdeps", specific_test, _dbus_sysdeps_test);
   
   run_test ("data-slot", specific_test, _dbus_data_slot_test);
+
+  run_test ("misc", specific_test, _dbus_misc_test);
   
   run_test ("address", specific_test, _dbus_address_test);
 

Index: dbus-test.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus-test.h,v
retrieving revision 1.32
retrieving revision 1.32.10.1
diff -u -d -r1.32 -r1.32.10.1
--- dbus-test.h	24 Feb 2005 16:03:56 -0000	1.32
+++ dbus-test.h	15 Nov 2006 03:07:28 -0000	1.32.10.1
@@ -36,6 +36,7 @@
 dbus_bool_t _dbus_marshal_byteswap_test  (void);
 dbus_bool_t _dbus_marshal_header_test    (void);
 dbus_bool_t _dbus_marshal_validate_test  (void);
+dbus_bool_t _dbus_misc_test              (void);
 dbus_bool_t _dbus_signature_test         (void);
 dbus_bool_t _dbus_mem_pool_test          (void);
 dbus_bool_t _dbus_string_test            (void);

Index: dbus.h
===================================================================
RCS file: /cvs/dbus/dbus/dbus/dbus.h,v
retrieving revision 1.24
retrieving revision 1.24.2.1
diff -u -d -r1.24 -r1.24.2.1
--- dbus.h	20 Oct 2006 05:16:58 -0000	1.24
+++ dbus.h	15 Nov 2006 03:07:28 -0000	1.24.2.1
@@ -33,6 +33,7 @@
 #include <dbus/dbus-errors.h>
 #include <dbus/dbus-macros.h>
 #include <dbus/dbus-message.h>
+#include <dbus/dbus-misc.h>
 #include <dbus/dbus-pending-call.h>
 #include <dbus/dbus-protocol.h>
 #include <dbus/dbus-server.h>



More information about the dbus-commit mailing list