summaryrefslogtreecommitdiff
path: root/src/session.c
AgeCommit message (Collapse)AuthorFilesLines
2014-07-17Imported Upstream version 1.24upstream/1.24Zhang zhengguang1-1062/+706
2013-06-10session: Use GList instead of GSequence for service listDaniel Wagner1-53/+41
The hash table is now the owner of the service entry instead of the service list.
2013-06-10session: Use service iterator instead of match/creation callbacksDaniel Wagner1-4/+20
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.
2013-05-31session: Add session identification method to configDaniel Wagner1-0/+4
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.
2013-05-31session: Do not access stale entry pointersDaniel Wagner1-3/+16
When removing the entry clear all references towards it.
2013-05-31session: Add session argument to create_service_entry_cbDaniel Wagner1-2/+6
Remember which session this struct service_entry belongs to when removing the entries again.
2013-05-22session: Fix service2bearer to return a correct match all ruleDaniel Wagner1-0/+1
2013-04-18session: Do not fail when creating default policy configurationDaniel Wagner1-13/+3
Do not handle the small alloc failures because glib will abort when memory is tight anyway.
2013-04-18session: Change to "func_t" postfix to callback typedefDaniel Wagner1-3/+3
Streamline the callback typedefs with the rest of the code.
2013-04-18session: Empty policy list indicated no match allDaniel Wagner1-1/+1
Match all is expressed via CONNMAN_SERVICE_TYPE_UNKNOWN. An empty list means no match.
2013-04-18session: Do not try to access already removed hashDaniel Wagner1-0/+3
Make sure we never try to cleanup when the hash table has been destroyed. In this case all resources have been freed already.
2013-01-04core: Remove WiMAX definitions from codePatrik Flykt1-6/+1
2012-12-05session: Call callback directly when no plugin is assignedDaniel Wagner1-8/+9
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).
2012-12-05session: Add a cleanup function for the user configDaniel Wagner1-13/+23
This helps to make the error path more readable.
2012-12-05session: Move cleanup/destroy function upDaniel Wagner1-48/+48
We need to call those function from create_policy_config() therefore more it in front of it.
2012-12-05session: Return error code from callbackDaniel Wagner1-1/+3
In the case the callback is directly called we can use the return value to provide it to the user.
2012-12-05session: Fix error case handlingDaniel Wagner1-2/+3
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.
2012-12-05session: Fix error return codeDaniel Wagner1-1/+1
The error codes propagated over D-Bus are non-negative values.
2012-12-05session: Remove notify watchDaniel Wagner1-0/+3
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.
2012-11-23session: Don't filter match all outDaniel Wagner1-0/+5
If the user provides the match all rule we should add the policy bearer to the result.
2012-11-23session: Store user AllowedBearers configurationDaniel Wagner1-5/+9
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.
2012-11-23session: Factor out set default config helperDaniel Wagner1-7/+17
Whenever a configuration gets invalid (e.g. a configuration is removed) then we need to be able to drop back to the default configutation.
2012-11-23session: Export session parsing functionsDaniel Wagner1-16/+38
We want to reuse these functions.
2012-11-23session: Add getter for session ownerDaniel Wagner1-0/+5
2012-11-23session: Add destroy function for pluginsDaniel Wagner1-1/+8
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.
2012-11-23session: Add sessions config update functionDaniel Wagner1-0/+40
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.
2012-11-05session: Register session after policy plugin returned configDaniel Wagner1-75/+89
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.
2012-11-05session: Factor out user settings in __connman_session_create()Daniel Wagner1-23/+48
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.
2012-11-05session: Remove struct connman_session_bearerDaniel Wagner1-95/+34
Instead start using enum connman_service_type directly.
2012-11-05session: Handle no match case in parse_bearers()Daniel Wagner1-0/+9
2012-11-05session: parse_bearers() should check for invalid typesDaniel Wagner1-2/+9
2012-11-05session: Rename session_parse_allowed_bearers() to parse_bearers()Daniel Wagner1-5/+3
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.
2012-11-05session: Remove match_all from connman_session_bearerDaniel Wagner1-35/+21
The match_all will be expressed through CONNMAN_SESSION_TYPE_UNKNOWN. The 'no match' case happens when allowed_bearers is NULL.
2012-11-05session: Remove name variable from connman_session_bearerDaniel Wagner1-7/+8
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.
2012-11-05session: Add callback to policy create()Daniel Wagner1-9/+23
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.
2012-11-05session: Policy register should check callback existenceDaniel Wagner1-0/+3
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.
2012-11-05session: Pick directly first policy in listDaniel Wagner1-8/+3
There is no point in iterating over the list when we always pick the first element in the list.
2012-11-05session: Factor out memory release part of cleanup_sessionDaniel Wagner1-9/+14
We want to reuse this code snippet for the error case in __connman_session_create() too.
2012-10-02session: If no policy plugin is selected use default configDaniel Wagner1-2/+12
2012-10-02session: Move the default config create part back to coreDaniel Wagner1-0/+21
2012-09-27session: Apply policy on AllowedBearersDaniel Wagner1-3/+100
2012-09-27session: Apply policy on ConnnectionTypeDaniel Wagner1-2/+22
2012-09-27session: Enforce correct ConnectionType settingsDaniel Wagner1-2/+12
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'.
2012-09-27session: Support no match in AllowedBearersDaniel Wagner1-24/+25
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.
2012-09-27session: Use g_slist_free_full to free bearer listDaniel Wagner1-3/+2
2012-09-27session: Add bearer list cleanup functionDaniel Wagner1-12/+10
2012-09-27session: Remove unused functionsDaniel Wagner1-33/+0
Basic types are not used for the configuration anymore.
2012-09-27session: Get config from policy pluginDaniel Wagner1-51/+29
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.
2012-09-27session: Allow plugin access to connman_session_allowed_bearers_anyDaniel Wagner1-3/+3
2012-09-27session: Move configuration bits to a public structDaniel Wagner1-51/+32
Instead of passing basic datatypes between the session core and the policy plugin, provide a complex data structure which holds the session configuration.