43 Commits

Author SHA1 Message Date
Bjorn Andersson
b804dcae1b cfg: Request and check return value
Request the return value of the operation from the kernel and check if
it's an error, to inform the user about e.g. not having sufficient
permission.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
v0.2
2017-06-06 22:15:33 -07:00
Bjorn Andersson
0b9959552e ns: Cleanup socket creation
Now that we only have one socket we can clean up the socket creation
code further.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:51:09 -07:00
Bjorn Andersson
a4aa8250c1 ns: Rename context socket
Now that we only have one socket for our context we can simplify the
name of the struct member.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:50:55 -07:00
Bjorn Andersson
0bc03abb43 ns: Remove the ns service
Now that we have moved all operations to the control socket we can
remove the ns handler. The query function in the library is racy, as
there might be non-response messages in our incoming buffer when we
start reading, so this is dropped too - rather than just being
translated to the new interface.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:50:54 -07:00
Bjorn Andersson
f775838736 lookup: Transition to using control port
Convert qrtr-lookup to use the control port for queries, allowing us to
drop the ns service altogether.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:49:31 -07:00
Bjorn Andersson
326aad23ae ns: Introduce lookup registration
Introduce a subscription based lookup model, in order for a client to be
able to listen to a future spawning service. The client can register any
number of queries with the ns and the ns will post lookup-results as
services are registred.

As a special case the list of lookup-results that is sent out as a
result of the registration of a new lookup will be finished by an empty
lookup response, allowing tools like qrtr-lookup to terminate as the
entire list of currently registed services is received.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:49:30 -07:00
Bjorn Andersson
e377bc8e84 lib: Replace qrtr_publish() and qrtr_bye() implementations
Replace the implementation of the two library functions with calls to
the new APIs, so that we can remove the server-side implementation of
the previous messages.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:47:00 -07:00
Bjorn Andersson
b4393f4515 ns: Handle BYE control message
The BYE control message signals that a node is gone, drop all services
from our register and propagate this message to all local servies - to
allow them to clean up any resources associated with potential remote
clients.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-07 04:46:42 +00:00
Bjorn Andersson
032b2443b3 ns: Make del_client always propagate del_client
Following the downstream kernel we should propagate a del_client to all
local services as the dying socket might have acted - or once acted - as
a client as well.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:44:59 -07:00
Bjorn Andersson
765aa8d57f ns: Implement DEL_CLIENT
Upon receiving a DEL_CLIENT some local or remote client has been
disconnected. If this is a local server we remove the server from the
lists and announce the removal to the remotes. Otherwise we need to
inform local servers that one of their clients might be gone, so we
propagate a DEL_SERVER message to all locally registered services.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:43:45 -07:00
Bjorn Andersson
ff29fb17a3 lib: Provide new API for clients to register services
Add a new set of operations to libqrtr for sending registration events
to the control service, rather than using the nameservice port.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 21:16:54 -07:00
Bjorn Andersson
35db849ec9 ns: Move qrtr_ctrl_cmd struct to ns.h
Move the qrtr_ctrl_cmd struct to the shared header file, order to
facilitate sending control messages directly from the library.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 12:39:43 -07:00
Bjorn Andersson
533edf89f5 ns: Cleanup debug and error prints
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-06 12:38:39 -07:00
Bjorn Andersson
fa0ef1f6e8 ns: Advertise new and removed services
Advertise services as we register and unregister them locally.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 21:33:40 -07:00
Bjorn Andersson
8241755aad make: Link non-static
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 21:32:55 -07:00
Bjorn Andersson
ccbf77b784 ns: Add static bcast_sq to context
A number of operations broadcasts messages, so store a static
broadcast socketaddr in the context to facilitate this.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 17:17:51 -07:00
Bjorn Andersson
7330b7ae54 ns: Store local node id in context
Store the local node id in the "context, rather than requesting the
local node id from the kernel every time we need it.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 14:01:34 -07:00
Bjorn Andersson
bea2306313 ns: Refactore control message handling
Refactor the control message handling to facilitate further development.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-06-05 12:44:21 -07:00
Bjorn Andersson
307507642b ns: Extract NS message handling into separate functions
Extract NS message handling in order to clean up the switch statement.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-31 23:00:42 -07:00
Bjorn Andersson
2485ba680e ns: Track services per node
In order to easily shoot down all services when a remote node goes away,
or list all local services when announcing inject a "node" layer above
the services map.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-31 23:38:58 +00:00
Bjorn Andersson
05194b078a qrtr: Hide build warning
With newer kernels AF_QIPCRTR is already defined in the system header
files, so don't define it unconditionaly.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-31 15:22:55 -07:00
Bjorn Andersson
30eeff5d57 qrtr: ns: Don't broadcast reset command
The kernel will broadcast the presence of the qrtr-ns to all locally
opened sockets and any remote sockets will be notified through other
means; so drop the reset notification.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-30 21:47:24 -07:00
Bjorn Andersson
0c269e3f04 qrtr-lookup: Make output easier to read
Format the output in nice columns to make things easier to read.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-05-01 20:31:13 -07:00
Bjorn Andersson
7d216fe3fb qrtr-cfg: Add to .gitignore
Add the qrtr-cfg to .gitignore

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2017-03-27 23:22:15 -07:00
Bjorn Andersson
dee8a384dc Merge pull request #2 from ndechesne/gnu
Makefile: add standard GNU makefiles directory variables
2016-11-28 22:13:37 -08:00
Nicolas Dechesne
d4697675ce Makefile: add standard GNU makefiles directory variables
This component is compiled in Debian and OE where we have multilib support
enabled by default, so let's use proper variables for Makefile so that distro
can better configure the destination folders.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-11-25 17:00:31 +01:00
Bjorn Andersson
56074bd5fe Merge pull request #1 from ndechesne/build
Various Makefile improvements
v0.1
2016-06-06 08:42:16 -07:00
Nicolas Dechesne
44bd79feb7 Makefile: implement GNU Coding Standard for Makefiles
GNU coding standards notably specifies:
 * install files with the $(DESTDIR) to the target system image
 * install files with the $(prefix), not $(PREFIX)
 * the default value of $(prefix) should be /usr/local

as per
https://www.gnu.org/prep/standards/html_node/Directory-Variables.html.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-06-06 01:18:50 +02:00
Nicolas Dechesne
ea3c58a2e2 makefile: install libqrtr.h file
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-06-06 01:18:18 +02:00
Nicolas Dechesne
b5cee337fa makefile: add support to install header file
New macro to be used to deploy header files when 'installing'. Use it as:

$(call add-inc-target,lib,foo.h)

to install file lib/foo.h

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-06-06 01:18:18 +02:00
Nicolas Dechesne
dcf148e15e makefile: split bin and lib targets macros
Build libraries with proper soname, real and linker names, using symlinks
appropriately.

As such, the generic macro 'add-target' can no longer be used for both
binary and libaries.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-06-06 01:18:12 +02:00
Nicolas Dechesne
6fb22ecfb1 makefile: create destination folder when installing files
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
2016-06-03 18:55:59 +02:00
Bjorn Andersson
8a1372cbfc qrtr: Use getsockname() instead of hardcoding local node id
Suggested-by: Courtney Cavin <ccavin@gmail.com>
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-06-01 18:15:16 -07:00
Bjorn Andersson
54081caa2f qrtr: Update AF_QIPCRTR to match kernel interface
The AF_QIPCRTR was merged into mainline as protocol #42.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-06-01 14:06:08 -07:00
Bjorn Andersson
d7c59006cb qrtr-cfg: Introduce node-id configuration tool
The final version of QRTR that was merged into v4.7 of the Linux kernel
requires a configuration step where we set the local node address.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-06-01 06:44:36 -07:00
Bjorn Andersson
a2cc96100c lookup: Add human readable service names
Add the list of human readable service names found in the libqmi
project.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-08 17:04:37 -08:00
Bjorn Andersson
18fc98b858 libqrtr: Extract the lib from the src directory
Extract the libqrtr source and header file to a separate directory,
making it more convinient to include the header file from other
projects.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-07 22:01:57 -08:00
Bjorn Andersson
763db9812c libqrtr: Add version to publish and bye prototypes
The instance is made up of 16 bits of version and 16 bits of instance,
the first is used upon matching services and must often be specified by
service implementations, so make it convenient to specify these.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-07 22:00:12 -08:00
Bjorn Andersson
4fedfec456 qrtr-ns: Announce registered local services to new remotes
Upon receiving a HELLO from the remote we need to advertise our
registered services for it to know about them.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-07 21:54:11 -08:00
Bjorn Andersson
39be874580 qrtr: Initialize sockaddr_qrtr for node 1
As node 0 is made a valid id in the kernel we're not allowed to specify
node 0 when binding our sockets. For now just hard code 1, as that's
where we are.

Either the kernel should define a reserved node id or we should have a
convenient way of specifying the local node, but for now this is good
enough.

Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-07 21:49:36 -08:00
Bjorn Andersson
3e11a3598b qrtr: Usage C99 stdint types instead of kernel types
Signed-off-by: Bjorn Andersson <bjorn.andersson@linaro.org>
2016-02-07 21:45:03 -08:00
Courtney Cavin
504c9c4a56 Use proper local node id for local messages
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
2015-12-16 15:21:08 -08:00
Courtney Cavin
4ec6c07f37 Initial commit
Signed-off-by: Courtney Cavin <courtney.cavin@sonymobile.com>
2015-12-04 13:23:53 -08:00