Age | Commit message (Collapse) | Author | Files | Lines |
|
Signed-off-by: hyunuktak <hyunuk.tak@samsung.com>
Change-Id: I84a42375b5c59739e4caca1f726699ea7647ef17
|
|
|
|
|
|
The hash table is now the owner of the service entry instead of
the service list.
|
|
When a new session is created we need to get the initial list
of services which match the session AllowedBearers criteria. As soon
the session is running add or removed services are tracked via the
notifier interface.
We concluded that exposing all the services is not really necessary
and therefore we are using currently two callbacks to get the initial
list. That exposes implementation details from session to service, that
is GSequence. We also need to expose the type 'struct service_entry'.
Instead doing so we are using an iterator and keep all the
implementation details in session.c.
|
|
The session core needs to the know which kind of session
identification method has been selected in the plugin in order
to use the right iptables rules etc.
|
|
When removing the entry clear all references towards it.
|
|
Remember which session this struct service_entry belongs to when
removing the entries again.
|
|
|
|
Do not handle the small alloc failures because glib will abort
when memory is tight anyway.
|
|
Streamline the callback typedefs with the rest of the code.
|
|
Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty
list means no match.
|
|
Make sure we never try to cleanup when the hash table has
been destroyed. In this case all resources have been
freed already.
|
|
|
|
When we have no plugin assigned we have to call the final
session callback directly.
Since __connman_session_create() doesn't know if a plugin was
called or not, create_policy_config() or __connman_session_create()
needs to free all allocated resources (also in the error path).
|
|
This helps to make the error path more readable.
|
|
We need to call those function from create_policy_config() therefore
more it in front of it.
|
|
In the case the callback is directly called we can use the
return value to provide it to the user.
|
|
There is no need to unref the pending message, because in all
cases we generate a reply message which takes care of unrefing
the message. Hence the dbus_message_unref() is not needed.
Furthermore, we need to pass the created error message to the bus
via g_dbus_send_message() so that the client gets always a response.
|
|
The error codes propagated over D-Bus are non-negative values.
|
|
free_session() will be also called from the error path (e.g.
__connman_session_create()). In case we have added a watch
we need to disarm it.
|
|
If the user provides the match all rule we should add the policy
bearer to the result.
|
|
Don't overwrite the user provided AllowedBearers
configuration. Instead just store it at session level. So we always
will apply the bearer filter on the user input.
Obviously, this might need some more improvements on how we want
to handle the AllowedBearers behavior when the policy plugin and
the application provide a configuration. For exmaple should
we update the AllowedBearers if the policy changes or just always
show only the user input. This patch is not perfect but it
improves the situation clearly.
|
|
Whenever a configuration gets invalid (e.g. a configuration
is removed) then we need to be able to drop back to the
default configutation.
|
|
We want to reuse these functions.
|
|
|
|
The error handling can get easily get pretty hairy, e.g.
reallocating memory for allowed_bearers. If we hit this situation
we allow the plugin to shutdown the session. That is consistent
with what we do when there is a problem while creating a new
session.
|
|
Give a policy plugin a way to inform the session core that
some of the config values have changed.
This could be done in a more clever way, e.g. figure out only
to update the necessary info entries but we keep it for now
as simple and assume everthing has changed.
|
|
Move the configuration part of __connman_session_create() into
session_create_cb(). With this change the policy plugin is able
to do async work to retrieve a configuration.
|
|
In order to be able to pass the user configuration provided through from
the D-Bus Manager.SessionCreate() call to the callback we need to store
the configuration into a local data data structure. This data structure
can then be passed into the callback introduced later on.
|
|
Instead start using enum connman_service_type directly.
|
|
|
|
|
|
This function name was a source of confusion because in a later patch
we introduce connman_session_parse_allowed_bearers() which will
call parse_bearers(). With this change it should be more readable.
|
|
The match_all will be expressed through CONNMAN_SESSION_TYPE_UNKNOWN.
The 'no match' case happens when allowed_bearers is NULL.
|
|
The string is only used when appending the bearer to the D-Bus
message in append_allowed_bearers(). Let's use
__connman_session_type2string() in append_allowed_bearers(). This
saves a bit of memory.
|
|
Instead returning directly a config when create() is called
in policy plugin, use a callback function for handing over a valid
configuration from the plugin to the session core. This prepares
support for asynchronous create call.
|
|
Let's ensure that the policy plugin has all necessary callbacks
installed when connman_session_policy_register() is called. The rest
of the code expects that the create() and destroy() callbacks exist
whenever a plugin is used.
|
|
There is no point in iterating over the list when we always
pick the first element in the list.
|
|
We want to reuse this code snippet for the error case in
__connman_session_create() too.
|
|
|
|
|
|
|
|
|
|
Up to now an empty or wrong ConnectionType was interpreted as 'any'.
If the ConnectionType is either wrong ignore it. If no ConnectionType
setting is passed in during creation of the session choose 'any'.
|
|
Up to now an empty AllowedBearers was interpreted as match any. Let's
make the match all explicit by expecting '*'. If an empty
AllowedBearers is provided, we interpret this as no match. In this
case the application will never get an online notifcation.
|
|
|
|
|
|
Basic types are not used for the configuration anymore.
|
|
Let's ask the plugin for the default configuration. AllowedBearers
and ConnectionType are not yet taken fromt the plugin. Instead
the user configuration will be taken.
|