profile/ivi/murphy.git
10 years agoresource: cope with NULL reqset in mrp_resource_lua_veto() v0.0.44 v0.0.45
Janos Kovacs [Wed, 5 Feb 2014 15:05:56 +0000 (17:05 +0200)]
resource: cope with NULL reqset in mrp_resource_lua_veto()

10 years agocommon: make sure the logger is never recursing
Krisztian Litkey [Wed, 29 Jan 2014 13:14:21 +0000 (15:14 +0200)]
common: make sure the logger is never recursing

Make sure the logger is never recursively invoked. The default logger
backend can never recurse. However with an overridden backend this
could happen, especially if the backend pushes log messages over a
transport or some other generic IPC. If something goes wrong at the
IPC level, an error is usually logged. If this results in an attempt
to use the same IPC we might end up recursing ad infinitum, or rather
ad stack-overflowtum...

Since we can't safely assume backends to properly check and handle
such a corner case, it is better to protect against this in the
common infra.

10 years agoplugin-console: configurable debug metadata, defaults to 'function'.
Krisztian Litkey [Wed, 29 Jan 2014 12:24:36 +0000 (14:24 +0200)]
plugin-console: configurable debug metadata, defaults to 'function'.

10 years agolua-timer: tostring thinko fixes.
Krisztian Litkey [Thu, 23 Jan 2014 08:41:37 +0000 (10:41 +0200)]
lua-timer: tostring thinko fixes.

10 years agolua-utils: fix MRP_LUA_LFUNC/MRP_LUA_FUNC setter type checks.
Krisztian Litkey [Thu, 23 Jan 2014 07:07:11 +0000 (09:07 +0200)]
lua-utils: fix MRP_LUA_LFUNC/MRP_LUA_FUNC setter type checks.

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal
Krisztian Litkey [Wed, 29 Jan 2014 13:42:38 +0000 (15:42 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agolua-utils: include missing header for bool.
Krisztian Litkey [Wed, 22 Jan 2014 11:01:39 +0000 (13:01 +0200)]
lua-utils: include missing header for bool.

10 years agomdb: fix the delete wrong line bug when updating the table.
Ismo Puustinen [Mon, 20 Jan 2014 13:41:51 +0000 (15:41 +0200)]
mdb: fix the delete wrong line bug when updating the table.

10 years agocommon: typeid -> type_id, because typeid is a C++ reserved word. v0.0.43
Ismo Puustinen [Thu, 16 Jan 2014 19:13:33 +0000 (21:13 +0200)]
common: typeid -> type_id, because typeid is a C++ reserved word.

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal
Krisztian Litkey [Thu, 16 Jan 2014 15:33:03 +0000 (17:33 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agocommon: don't allow mark_deleted corrupt the pending deleted list.
Krisztian Litkey [Thu, 16 Jan 2014 12:59:36 +0000 (14:59 +0200)]
common: don't allow mark_deleted corrupt the pending deleted list.

Make sure mark_deleted is not called twice for timer, deferred,
or wakeup objects to prevent it from corrupting the list of
pending deleted objects. The corruption itself is the result
of the same object being linked twice to the pending list and
consequently free'd twice. The other types of objects were
correctly protected against this.

The 'safeguard' is just check that the object had not been deleted
before calling mark_deleted. It would be safer to add this check to
mark_deleted itself but since the check is usually needed to protect
other things as well it is now done always by the caller.

10 years agomdb: free memory if an update doesn't cause a row to be changed.
Ismo Puustinen [Thu, 16 Jan 2014 12:45:23 +0000 (14:45 +0200)]
mdb: free memory if an update doesn't cause a row to be changed.

10 years agocommon: small transport fixes to enable socket-based activation.
Krisztian Litkey [Tue, 14 Jan 2014 19:38:13 +0000 (21:38 +0200)]
common: small transport fixes to enable socket-based activation.

This patch fixes the most obvious shortcomings in the transport
implementation that currently prevented us from having transport
socket-based activation. With this patch in place, socket-based
activation should work for stream transports.

10 years agocommon: exercise some of the extra types in native-types test.
Krisztian Litkey [Tue, 14 Jan 2014 10:35:46 +0000 (12:35 +0200)]
common: exercise some of the extra types in native-types test.

10 years agocommon: int/short/size_t support for native-types.
Krisztian Litkey [Mon, 13 Jan 2014 14:02:46 +0000 (16:02 +0200)]
common: int/short/size_t support for native-types.

Added support for unsigned/signed int's, unsigned/signed short's,
size_t's and ssize_t's. All of these types are encoded as 32-bit
integers (and currently without a check for overflow, so now you
have been warned).

10 years agoMerge branch 'master' of github.com:01org/murphy submit/tizen/20140110.142837
Krisztian Litkey [Fri, 10 Jan 2014 14:17:11 +0000 (16:17 +0200)]
Merge branch 'master' of github.com:01org/murphy

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal v0.0.42
Krisztian Litkey [Thu, 9 Jan 2014 16:28:48 +0000 (18:28 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agoresolver: don't fail when asked to generate empty autopdate target.
Krisztian Litkey [Thu, 9 Jan 2014 16:21:40 +0000 (18:21 +0200)]
resolver: don't fail when asked to generate empty autopdate target.

10 years agoresource: turn off advice for same class if class ordering is lifo.
Ismo Puustinen [Thu, 9 Jan 2014 14:43:47 +0000 (16:43 +0200)]
resource: turn off advice for same class if class ordering is lifo.

10 years agosample-config: added a sample entry for a console over D-Bus transport.
Krisztian Litkey [Wed, 8 Jan 2014 16:04:02 +0000 (18:04 +0200)]
sample-config: added a sample entry for a console over D-Bus transport.

10 years agodbus-transport: fixes for the new D-Bus abstraction.
Krisztian Litkey [Wed, 8 Jan 2014 16:03:28 +0000 (18:03 +0200)]
dbus-transport: fixes for the new D-Bus abstraction.

10 years agocommon/test: don't try to unconditionally compile sdbus-error-message.
Krisztian Litkey [Wed, 8 Jan 2014 12:30:04 +0000 (14:30 +0200)]
common/test: don't try to unconditionally compile sdbus-error-message.

10 years agoresource-dbus: use libdbus, not systemd-bus.
Krisztian Litkey [Wed, 8 Jan 2014 12:29:26 +0000 (14:29 +0200)]
resource-dbus: use libdbus, not systemd-bus.

10 years agoresource: temporary enforcement of 'dont_wait' and 'auto_release' from LUA
Janos Kovacs [Tue, 7 Jan 2014 08:11:26 +0000 (10:11 +0200)]
resource: temporary enforcement of 'dont_wait' and 'auto_release' from LUA

10 years agoresource: pass the requesting resource set in an argument to the veto functions
Janos Kovacs [Mon, 6 Jan 2014 16:58:53 +0000 (18:58 +0200)]
resource: pass the requesting resource set in an argument to the veto functions

10 years agoresource: add 'resource_set_id' column to resource owner tables
Janos Kovacs [Fri, 3 Jan 2014 19:04:43 +0000 (21:04 +0200)]
resource: add 'resource_set_id' column to resource owner tables

10 years agobuild-sys: install dbus-error.h.
Krisztian Litkey [Wed, 8 Jan 2014 17:30:18 +0000 (19:30 +0200)]
build-sys: install dbus-error.h.

10 years agocommon: allow setting a mapping table of native-type id's for transports.
Krisztian Litkey [Wed, 11 Dec 2013 22:34:18 +0000 (00:34 +0200)]
common: allow setting a mapping table of native-type id's for transports.

Added support for a native-type id mapping table for transports. This
is necessary to avoid the problems arising from not having the exactly
same set of native-types registered (or having the same set registered
in different order) by the communicating parties. With this mechanism,
it is enough for the communicating parties to agree about the ids of
the native-types passed over that particular instance of transport
instead of having to agree about the ids of all the registered native-
types over all the transports.

The support is still a bit lacky on the user-friendliness side. We'll
probably need a few additional macros and convenience functions to
allow people to easily set up a mapping table correctly.

10 years agocommon: small inclusion and macro fixes for native-types.
Krisztian Litkey [Wed, 11 Dec 2013 22:32:34 +0000 (00:32 +0200)]
common: small inclusion and macro fixes for native-types.

10 years agoMerge branch 'systemd-bus+native-types'
Krisztian Litkey [Wed, 8 Jan 2014 11:33:29 +0000 (13:33 +0200)]
Merge branch 'systemd-bus+native-types'

10 years agoresolver: print the resolver graph to console in DOT format.
Ismo Puustinen [Tue, 17 Dec 2013 14:50:46 +0000 (16:50 +0200)]
resolver: print the resolver graph to console in DOT format.

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal v0.0.40 v0.0.41
Krisztian Litkey [Fri, 13 Dec 2013 22:02:57 +0000 (00:02 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agolua-decision: don't crash in table/select constructor if arg is not table.
Janos Kovacs [Fri, 13 Dec 2013 12:35:42 +0000 (14:35 +0200)]
lua-decision: don't crash in table/select constructor if arg is not table.

10 years agoresource-dbus: fix a buffer overflow.
Ismo Puustinen [Wed, 11 Dec 2013 13:17:47 +0000 (15:17 +0200)]
resource-dbus: fix a buffer overflow.

10 years agoresource-dbus: fix a buffer overflow.
Ismo Puustinen [Wed, 11 Dec 2013 13:17:47 +0000 (15:17 +0200)]
resource-dbus: fix a buffer overflow.

10 years agolua-bindings: added murphy.disable_include(), for disabling inclusion.
Krisztian Litkey [Fri, 6 Dec 2013 17:22:36 +0000 (19:22 +0200)]
lua-bindings: added murphy.disable_include(), for disabling inclusion.

10 years agolua-utils: get rid of a compiler warning.
Krisztian Litkey [Thu, 5 Dec 2013 17:54:00 +0000 (19:54 +0200)]
lua-utils: get rid of a compiler warning.

10 years agolua-bindings: reworked Murphy.include & co. to use mrp_lua_include_file.
Krisztian Litkey [Thu, 5 Dec 2013 15:59:19 +0000 (17:59 +0200)]
lua-bindings: reworked Murphy.include & co. to use mrp_lua_include_file.

Rewrote include and try_include to use mrp_lua_include_file as the
underlying file inclusion mechanism. The newly introduced *_once
versions of these only include any given file at most once. When using
one of these, subsequent inclusion of an already included file will
silently succeed without re-reading or re-evaluating the file.

10 years agolua-utils: added mrp_lua_include_file.
Krisztian Litkey [Thu, 5 Dec 2013 15:58:09 +0000 (17:58 +0200)]
lua-utils: added mrp_lua_include_file.

Added mrp_lua_include_file as the basic building block for a
simple C-like Lua inclusion mechanism. You can provide a
file, a list of directories to searchi, and optionally a list
to administer successfully included files. If the provided file
name is not a absolute one, the given directories are searched
for the file. If the provided list is not NULL, any given file
will be included at most once.

10 years agocommon: added mrp_find_file for doing #include-like file search.
Krisztian Litkey [Thu, 5 Dec 2013 15:56:05 +0000 (17:56 +0200)]
common: added mrp_find_file for doing #include-like file search.

mrp_find_file searches for the given file in the given set of
directories. If the file name is absolute it is used as such.
Otherwise the given set of directories (and the current working
directory) are searched. If a match is found, it is tested for
access using the given mode. If the found file is accessible,
the resolved path is copied to the given buffer.

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal
Krisztian Litkey [Wed, 4 Dec 2013 23:32:34 +0000 (01:32 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agolua-bindings: first shot at Murphy.include/Murphy.try_include, for more modular confi...
Krisztian Litkey [Wed, 4 Dec 2013 23:31:29 +0000 (01:31 +0200)]
lua-bindings: first shot at Murphy.include/Murphy.try_include, for more modular configuration.

10 years agocommon/test: post-merge Makefile.am fix.
Krisztian Litkey [Mon, 25 Nov 2013 20:14:26 +0000 (22:14 +0200)]
common/test: post-merge Makefile.am fix.

10 years agocommon: adjusted dbus MRP_REGISTER_TRANSPORT usage.
Krisztian Litkey [Mon, 25 Nov 2013 19:44:03 +0000 (21:44 +0200)]
common: adjusted dbus MRP_REGISTER_TRANSPORT usage.

10 years agocommon/dbus: added patch for Fedora 19/systemd-204 src.rpm.
Krisztian Litkey [Tue, 8 Oct 2013 13:54:02 +0000 (16:54 +0300)]
common/dbus: added patch for Fedora 19/systemd-204 src.rpm.

If you download the official Fedora 19 systemd source RPM, patch
it with this patch and rebuild, you should get two additional
subpackages: systemd-libs-dbus and systemd-libs-dbus-devel. These
include a shared version of systemd's dbus library, systemd-bus.
Installing these should allow you to test/use the systemd-bus based
version of murphy-dbus.

10 years agocommon/dbus: added patch for Fedora 18/systemd-201 src.rpm.
Krisztian Litkey [Thu, 29 Aug 2013 23:08:43 +0000 (02:08 +0300)]
common/dbus: added patch for Fedora 18/systemd-201 src.rpm.

If you download the official Fedora 18 systemd source RPM, patch
it with this patch and rebuild, you should get two additional
subpackages: systemd-libs-dbus and systemd-libs-dbus-devel. These
include a shared version of systemd's dbus library, systemd-bus.
Installing these should allow you to test/use the systemd-bus based
version of murphy-dbus.

10 years agocommon: added a unit test for sdbus error message handling.
Ismo Puustinen [Wed, 25 Sep 2013 08:02:58 +0000 (11:02 +0300)]
common: added a unit test for sdbus error message handling.

10 years agoresource-dbus: converted to new D-Bus library API.
Ismo Puustinen [Mon, 23 Sep 2013 10:05:02 +0000 (13:05 +0300)]
resource-dbus: converted to new D-Bus library API.

10 years agocommon/dbus: systemd-bus based murphy-dbus implementation.
Krisztian Litkey [Tue, 20 Aug 2013 08:30:32 +0000 (11:30 +0300)]
common/dbus: systemd-bus based murphy-dbus implementation.

Added an alternative murphy-dbus implementation based on the
low-level D-Bus library (systemd-bus) from systemd. This needs
a patched systemd to build and install systemd-bus as a shared
library.

To get rid of libdbus-dependency it was also necessary to provide
an abstraction for message building and parsing and hence break
backward compatibility. To ease the transitional pain, we provide
currently three version of murphy-dbus: the original one with the
leaky message abstraction, as well as a libdbus- and a systmed-bus-
based one with the new abstraction. Once all the code has been
updated to not use directly libdbus calls for message building and
parsing, the original library will be removed.

10 years agoresource: fixed issues reported by static analysis.
Ismo Puustinen [Mon, 25 Nov 2013 14:20:58 +0000 (16:20 +0200)]
resource: fixed issues reported by static analysis.

10 years agotests: fixed issues reported by static analysis.
Ismo Puustinen [Mon, 25 Nov 2013 13:15:29 +0000 (15:15 +0200)]
tests: fixed issues reported by static analysis.

10 years agocommon: initial support for native transport mode.
Krisztian Litkey [Mon, 25 Nov 2013 11:30:43 +0000 (13:30 +0200)]
common: initial support for native transport mode.

Added transport mode MRP_TRANSPORT_MODE_NATIVE to transmit
and receive registered native-type's. Now that it's been a
while since I last dug in, I can tell the transport infra
could use a heavy-handed cleanup / refactoring.

10 years agocommon: arrays of basic types in native-types.
Krisztian Litkey [Mon, 25 Nov 2013 11:05:38 +0000 (13:05 +0200)]
common: arrays of basic types in native-types.

Hmm... looks like I've partially overlooked/forgotten about
arrays of basic types. Part of the code was there, part was
missing and part was simply broken. With this band-aid fix,
at least the basic cases should work. Let's see what else is
missing...

10 years agolua-resource: initial Lua bindings to resource library.
Ismo Puustinen [Wed, 13 Nov 2013 11:41:25 +0000 (13:41 +0200)]
lua-resource: initial Lua bindings to resource library.

10 years agocommon: more versatile data serialization via native-types.
Krisztian Litkey [Fri, 25 Oct 2013 09:38:29 +0000 (12:38 +0300)]
common: more versatile data serialization via native-types.

Added native-types (and a primitive TLV encoder/decoder) to
provide more flexible and versatile data/type serialization.

Ideally (and eventually) we'd like to be able to throw any
natively declared data type at any supported transport and
have that automatically take care of the serialization and
deserialization necessary for transmission. Although with
this initial implementation we're far not there yet, this
should already provide a much more flexible framework to
work with and later build upon than what the original
MRP_TRANSPORT_MODE_DATA is capable of providing.

There are still quite a few rough edges and features either
missing or not fully implemented, including but not limited
to

  - support for unions,
  - implement blobs,
  - automatic handling of linked lists of known types
  - support all the (sensible) type/layout combinations
  - allow self- and cross-referencing data types (IOW
    allow forward-references to yet undeclared types, and
    provide a function for checking if a type is complete,
    ie. there are no undeclared types it references, and
    this holds true also for all its referenced types)

Eventually we'd like to get to the point where, instead of
having to keep the limitations of the available transport
encoding and decoding in mind, one could freely design data
types as seen fit, and the transports could always handle
them.

10 years agodaemon,core: unlink all blacklisted builtin plugins.
Krisztian Litkey [Sat, 23 Nov 2013 12:39:14 +0000 (14:39 +0200)]
daemon,core: unlink all blacklisted builtin plugins.

Brutally unlink all blacklisted builtin plugins to make them
unreachable by ordinary means.

10 years agoMerge branch 'master' of github.com:otcshare/policy-internal
Krisztian Litkey [Fri, 22 Nov 2013 19:23:25 +0000 (21:23 +0200)]
Merge branch 'master' of github.com:otcshare/policy-internal

10 years agolua-utils: can't call mrp_lua_get_lua_state, pulls in core. v0.0.39
Krisztian Litkey [Fri, 22 Nov 2013 14:20:18 +0000 (16:20 +0200)]
lua-utils: can't call mrp_lua_get_lua_state, pulls in core.

10 years agolua-utils: added missing include.
Krisztian Litkey [Fri, 22 Nov 2013 14:11:50 +0000 (16:11 +0200)]
lua-utils: added missing include.

10 years agoresource: fix a memory corruption issue.
Ismo Puustinen [Thu, 21 Nov 2013 21:48:52 +0000 (23:48 +0200)]
resource: fix a memory corruption issue.

10 years agolua-utils: fixed a few uninitialized var warnings.
Krisztian Litkey [Wed, 20 Nov 2013 17:22:39 +0000 (19:22 +0200)]
lua-utils: fixed a few uninitialized var warnings.

10 years agolua-utils: allocation tracking for the Lua object infra
Krisztian Litkey [Wed, 20 Nov 2013 01:14:05 +0000 (03:14 +0200)]
lua-utils: allocation tracking for the Lua object infra

If enabled, the object infra keeps track of all allocated and
still uncollected objects on a per classdef basis. Upon exit
all existing objects are dumped to stdout.

This behavior is enabled by setting __MURPHY_LUA_CONFIG="track=yes".
Setting it to any other value (than true, or on) or clearing the
environment variables disables object tracking.

10 years agocommon: added mrp_env_config_* for fetching pre-startup configuration.
Krisztian Litkey [Wed, 20 Nov 2013 01:07:00 +0000 (03:07 +0200)]
common: added mrp_env_config_* for fetching pre-startup configuration.

These routines are meant to pass configuration information to the
Murphy common/core infrastructure in cases where the configuration
needs to be obtained and activated before the startup sequence is
complete. A typical example would be to select whether to use the
stock allocator as such or to enable the built-in leak-checking and
tracking capabilities. Configuration for these kinds of features is
passed in special environment variables which there routines are
designed to extract information from.

10 years agolua-utils: some sketch about how error path cleanup could look like.
Krisztian Litkey [Mon, 18 Nov 2013 23:31:11 +0000 (01:31 +0200)]
lua-utils: some sketch about how error path cleanup could look like.

10 years agolua-utils: fix getfield thinko (not a setfield), try more intuitive behavior.
Krisztian Litkey [Tue, 19 Nov 2013 20:35:02 +0000 (22:35 +0200)]
lua-utils: fix getfield thinko (not a setfield), try more intuitive behavior.

If a class is not marked extensible but it has overridden getfield
and setfield, always pass these operations for unrecognized members,
(members that have not been declared explicitly) to the overridden
handlers. If a class is marked extensible, only pass those members
to the overridden handlers that are whitelisted.

The same commit also fiddles a bit around in a seeming attempt to
unify the return value convention of setext/setiext/getext/getiext.
On a second thought, I think this was a rather pointless now. Error
handling will anyway need a thorough review cycle followed by a
systematic swipe through the code base unifying and rationalizing
all the error paths. We need to be especially careful with code that
can be called both from C and Lua context and make sure that throwing
a Lua error will not leave half-created/initialized objects hanging
around from nowhere just leaking memory.

10 years agolua-bindings: added a very primitive module exposing bitwise operations to Lua.
Krisztian Litkey [Mon, 18 Nov 2013 17:47:40 +0000 (19:47 +0200)]
lua-bindings: added a very primitive module exposing bitwise operations to Lua.

10 years agocommon/debug: check the proxied debug site in mrp_debug_at.
Krisztian Litkey [Mon, 18 Nov 2013 23:13:09 +0000 (01:13 +0200)]
common/debug: check the proxied debug site in mrp_debug_at.

10 years agolua-utils: get rid of unused function warning.
Krisztian Litkey [Mon, 18 Nov 2013 12:44:39 +0000 (14:44 +0200)]
lua-utils: get rid of unused function warning.

10 years agolua-bindings: updated transport bindings MRP_LUA_DEFINE_CLASS macro usage.
Krisztian Litkey [Sun, 17 Nov 2013 20:07:26 +0000 (22:07 +0200)]
lua-bindings: updated transport bindings MRP_LUA_DEFINE_CLASS macro usage.

10 years agolua-bindings: updated MRP_LUA_DEFINE_CLASS macro usage.
Krisztian Litkey [Sun, 17 Nov 2013 20:06:09 +0000 (22:06 +0200)]
lua-bindings: updated MRP_LUA_DEFINE_CLASS macro usage.

10 years agolua-utils: infra support for object stringification.
Krisztian Litkey [Sun, 17 Nov 2013 20:04:24 +0000 (22:04 +0200)]
lua-utils: infra support for object stringification.

10 years agolua-bindings: updated most bindings to used MRP_LUA_DEFINE_CLASS macro.
Krisztian Litkey [Sat, 16 Nov 2013 23:57:17 +0000 (01:57 +0200)]
lua-bindings: updated most bindings to used MRP_LUA_DEFINE_CLASS macro.

10 years agolua-utils: added MRP_LUA_DEFINE_CLASS macro, comments for defining classes.
Krisztian Litkey [Sat, 16 Nov 2013 23:55:38 +0000 (01:55 +0200)]
lua-utils: added MRP_LUA_DEFINE_CLASS macro, comments for defining classes.

10 years agolua-utils: simple stylistic unification, basic comments on visible routines.
Krisztian Litkey [Sat, 16 Nov 2013 21:23:19 +0000 (23:23 +0200)]
lua-utils: simple stylistic unification, basic comments on visible routines.

10 years agolua-utils: support for automatically bridged member methods
Krisztian Litkey [Sat, 16 Nov 2013 22:24:59 +0000 (00:24 +0200)]
lua-utils: support for automatically bridged member methods

Added support for 'automatically bridged' member methods, a bit
akin to our 'automatically handled members'. These methods will
get their arguments readily fetched and decoded/converted from
the Lua stack into native C types on behalf of them in a fairly
type-safe manner (sans method signature misadvertising, of course).

The dirty details and heavy lifting of the actual type conversion
and bridging is taken care of by the nifty funcbridge infrastructure.

10 years agocommon: added a macro for debug messages with explicitly specified site-info.
Krisztian Litkey [Sat, 16 Nov 2013 22:23:52 +0000 (00:23 +0200)]
common: added a macro for debug messages with explicitly specified site-info.

10 years agolua-utils: support for typed objects, arrays, and autobridged members.
Krisztian Litkey [Sat, 16 Nov 2013 22:08:21 +0000 (00:08 +0200)]
lua-utils: support for typed objects, arrays, and autobridged members.

Extended funcbridge to support type-checked arrays and (murphy
core/lua-utils/object-infra) objects. The extensions include

  - signature extensions for object and array specifications:
      o [s|d|f]:     an array of strings, integers, or doubles
      o [*]:         an array of any of the above types
      o O(<C-type>): a Lua object of the given registered Murphy C type
      o O(*):        a Lua object of any of the registered Murphy C types
  - collecting, type-checking, and passing arrays to bridged calls
  - fetching, type-checking, and passing objects to bridged calls

Additionally, as calls to funcbridge member methods (from Lua to C)
arrive at funcbridge with an extra table at the bottom of the stack,
this needs special treatment if we want to make the bridged calls
with a genuine-looking stack. Funcbridge now has the necessary code
to patch the stack before the bridge (taking care of preventing any
garbage collection of temporarily removed objects), if the bridged
callee has indicated its desire for this.

10 years agolua-utils: macros to produce a simple debug dump of the Lua stack.
Krisztian Litkey [Sat, 16 Nov 2013 22:05:08 +0000 (00:05 +0200)]
lua-utils: macros to produce a simple debug dump of the Lua stack.

10 years agolua-utils: formalized object/userdata conversion, stricter validation.
Krisztian Litkey [Thu, 14 Nov 2013 19:39:14 +0000 (21:39 +0200)]
lua-utils: formalized object/userdata conversion, stricter validation.

Added a few macros and inlines to do checked and unchecked/trusted
conversion between objects and userdata. Changed all existing code
to use these. This should also make it easier to switch to a different
association mechanism/model when we move to Lua 5.2 or later.

Also added compile-time selectable stricter checking for valid userdata.
The stricter version stores the self pointer XOR'ed with the data
pointer. This should prevent us from misidentifying an empty linked
list or hook for a valid userdata.

10 years agoWiP: infantile transport testing in sample config.
Krisztian Litkey [Wed, 13 Nov 2013 23:44:20 +0000 (01:44 +0200)]
WiP: infantile transport testing in sample config.

10 years agolua-bindings: embrionic first incarnation of transport bindings.
Krisztian Litkey [Wed, 13 Nov 2013 23:25:29 +0000 (01:25 +0200)]
lua-bindings: embrionic first incarnation of transport bindings.

Added a limited first prototype of the transport bindings. This
one only does custom/JSON-encoding, and there is no sending in
place yet at all...

10 years agolua-utils: first attempt at error handling macros.
Krisztian Litkey [Thu, 14 Nov 2013 16:46:16 +0000 (18:46 +0200)]
lua-utils: first attempt at error handling macros.

10 years agolua-bindings: added mrp_json_lua_unwrap.
Krisztian Litkey [Thu, 14 Nov 2013 16:41:34 +0000 (18:41 +0200)]
lua-bindings: added mrp_json_lua_unwrap.

10 years agolua-bindings: check for failure of object class creation.
Krisztian Litkey [Thu, 14 Nov 2013 16:40:07 +0000 (18:40 +0200)]
lua-bindings: check for failure of object class creation.

10 years agolua-utils: mandate constructor, pointer-based type-check, raw setter/getter.
Krisztian Litkey [Thu, 14 Nov 2013 16:34:33 +0000 (18:34 +0200)]
lua-utils: mandate constructor, pointer-based type-check, raw setter/getter.

Don't allow registration of classes without a constructor.

Added mrp_lua_pointer_of_type for checking the type of the given
object. Note that the caller better make/be sure that the passed
pointer is definitely an instance of one of our classes, otherwise
horrible mayhem will ensue (as the now non-existing userdata is
accessed).

Added support (currently untested) for raw getters and setters.
These are called without a value pointer and are expected to
pop, decode, push and encode values from and to the Lua stack
themselves.

Also removed non-explicit member autoinitialization. The dominant
pattern is to set members to defaults in the constructor and then
call mrp_lua_init_members if there is table of initial values
passed to the construcor.

10 years agolua-utils: PRIVREFS flag and handling, userdata/data conversion routines.
Krisztian Litkey [Thu, 14 Nov 2013 10:30:21 +0000 (12:30 +0200)]
lua-utils: PRIVREFS flag and handling, userdata/data conversion routines.

Added MRP_LUA_CLASS_PRIVREFS, supporting classes to choose between a
private and common reference tables. For instances of classes with a
private, all references the object owns will be automatically cleaned
up when the object is destroyed along with its privte reference table.

Also added static inline retrieval routines for getting to an object
from its userdata and vice versa (instead of the manual +/- 1-ing) to
help hide the internal details of the association mechanism. Still
need to go through the code and replace all +/- 1 instances with calls
to these.

10 years agolua-utils: added ref reffing + simple class-checker macro.
Krisztian Litkey [Wed, 13 Nov 2013 23:18:25 +0000 (01:18 +0200)]
lua-utils: added ref reffing + simple class-checker macro.

Added mrp_lua_object_getref/putref for getting a private reference
from a reference owner by another object. Also added for simple
cases MRP_LUA_CLASS_CHECKER, a macro which automatically generates
a trivial minimalistic class checker (idx to class pointer) function..

10 years agolua-bindings: push only once on mrp_json_lua_push.
Krisztian Litkey [Wed, 13 Nov 2013 22:51:01 +0000 (00:51 +0200)]
lua-bindings: push only once on mrp_json_lua_push.

10 years agolua-utils: added MRP_LUA_CLASS_NOINIT flag.
Krisztian Litkey [Wed, 13 Nov 2013 12:19:43 +0000 (14:19 +0200)]
lua-utils: added MRP_LUA_CLASS_NOINIT flag.

10 years agolua-utils: support objects of a specific type as automatic members.
Krisztian Litkey [Wed, 13 Nov 2013 00:09:45 +0000 (02:09 +0200)]
lua-utils: support objects of a specific type as automatic members.

10 years agolua-bindings: fix inverted enabling/disabling debug printout.
Krisztian Litkey [Tue, 12 Nov 2013 23:59:38 +0000 (01:59 +0200)]
lua-bindings: fix inverted enabling/disabling debug printout.

10 years agolua-bindings: don't add timer when callback is set if we already have one.
Krisztian Litkey [Tue, 12 Nov 2013 23:57:08 +0000 (01:57 +0200)]
lua-bindings: don't add timer when callback is set if we already have one.

10 years agolua-utils: support arrays as automatic members.
Krisztian Litkey [Tue, 12 Nov 2013 15:44:00 +0000 (17:44 +0200)]
lua-utils: support arrays as automatic members.

10 years agodaemon: added command-line option to disable runtime plugin loading.
Krisztian Litkey [Thu, 21 Nov 2013 15:48:02 +0000 (17:48 +0200)]
daemon: added command-line option to disable runtime plugin loading.

10 years agodaemon: added command-line option to disable debug console.
Krisztian Litkey [Wed, 20 Nov 2013 23:34:10 +0000 (01:34 +0200)]
daemon: added command-line option to disable debug console.

10 years agodaemon: implemented blacklisting/whitelisting of plugins.
Krisztian Litkey [Wed, 20 Nov 2013 22:45:26 +0000 (00:45 +0200)]
daemon: implemented blacklisting/whitelisting of plugins.

Currently plugins can only be blacklisted/whitelisted on the
command line. You can specify blacklists and whitelists separately
for builtin plugins, dynamic plugins, and plugins of either type.
You can use the special tokens '*' and 'all' as wildcards which
match all tokens. Using wildcards you can easily blacklist or
whitelist all plugins of any or a certain kind then puch holes
on the whiltelists or blacklists.

Examples:
  - to blacklist all builtin plugins, use:
        murphyd --blacklist-builtin '*'

  - to blacklist all builtin plugins except lua and resource-native, use:
        murphyd --blacklist-builtin '*' --whitelist-builtin lua,resource-native

  - to consider all external plugins untrusted and blacklist them, use:
        murphyd --blacklist-dynamic '*'

  - to disable the console:
        murphyd --blacklist console,wrt-console

Note that only the names of builtin plugins can be (somewhat) trusted
and even those cannot be trusted if you don't have any extra mechanisms
for the integrity protection of binaries and libraries. External plugins
can always be copied/moved under a different name, so disabling any
specific external plugin by name should not be considered secure by any
means. One typical usage of these options is to disable loading of any
external plugins.

10 years agobuild-sys: finally, remove all *-func-info.c from the repo.
Krisztian Litkey [Wed, 20 Nov 2013 20:45:29 +0000 (22:45 +0200)]
build-sys: finally, remove all *-func-info.c from the repo.

10 years agoresolver: pkg-config fixes.
Krisztian Litkey [Tue, 12 Nov 2013 10:47:48 +0000 (12:47 +0200)]
resolver: pkg-config fixes.

10 years agolua-bindings: don't declare an unused variable by a macro.
Krisztian Litkey [Mon, 11 Nov 2013 20:18:07 +0000 (22:18 +0200)]
lua-bindings: don't declare an unused variable by a macro.

10 years agolua-bindings: fix luaL_error induced uninitialized false positives.
Krisztian Litkey [Mon, 11 Nov 2013 20:15:46 +0000 (22:15 +0200)]
lua-bindings: fix luaL_error induced uninitialized false positives.