summaryrefslogtreecommitdiff
path: root/include/session.h
Commit message (Collapse)AuthorAgeFilesLines
* session: Add ContextIdentifierBjoern Thorwirth2017-10-051-0/+1
| | | | | | | | | | | | | | | The calling process, that implements the session API is identified by the user ID as it is runs. All processes of the same user share the same list of allowed bearers, and the same priority for choosing between available bearers. This extension allows processes to select a service context dependent behaviour for which the routing decision is made. This is an extention to session API interface. Helps to enable a service differentiation for processes run by the same user. Allows ConnMan to differentiate between bearer usage permissions and the respective priorities based on the requested service type.
* session: Interface to query session->mark valueBjoern Thorwirth2017-05-031-0/+2
| | | | | Will return the session mark (without needing to expose the complete struct connman_session).
* session: Callback hook for policy plugin to return service of sessionBjoern Thorwirth2017-05-031-0/+2
| | | | | Returns the allowed service for a session based on a provided list of available services.
* session: Callback hook for policy plugins to update session stateBjoern Thorwirth2017-05-031-0/+8
| | | | Called when state of session changes.
* session: Add source ip ruleLukasz Nowak2017-02-041-0/+1
| | | | | | | | | | | | | Implement an option for a session to enable packet filtering based on interfce source ip address. This allows an application to create a session, and direct traffic to a specific network interface, on which the session is connected. Applications can use bind before connect on a socket to specify the source ip address. This mechanism re-uses the routing table created by the session, iproute fwmark rule, and adds a new iptables source ip rule.
* session: Add AllowedInterface config parameterLukasz Nowak2017-02-041-0/+1
| | | | | | | | | | In order to be able to bind a session to a specific interface, AllowedInterface config option has been added. It allows to bind a session to a service with a specified network interface name (e.g. eth0). AllowedInterface is supported through both dbus and session policy. Policy always overrides dbus.
* include: Fix copyright statementDaniel Wagner2014-07-221-1/+1
| | | | | | | | | | The copyright statement for my company is not consistent or even wrongly spelled. s/All rights reserved// s/CarIT/Car IT/ s/BWM/BMW/ s/GbmH/GmbH/
* session: Add connect/disconnect servicesDaniel Wagner2014-03-131-0/+3
| | | | | Ensure that connect/disconnect reason is properly set to CONNMAN_SERVICE_CONNECT_REASON_SESSION.
* session: Add policy plugin allowed callbackDaniel Wagner2014-03-131-0/+2
| | | | | Check with the session policy whether a specific service is allowed for a session.
* session: Add policy session_changed callbackDaniel Wagner2014-03-131-1/+2
| | | | | This callback updates the session policy when the session becomes active or inactive.
* session: Add session policy autoconnect supportPatrik Flykt2014-02-171-0/+2
| | | | | By default allow all autoconnects if no session policy module exists or no autoconnect policy function is supplied.
* build: Remove unsued types.h headerDaniel Wagner2013-07-231-1/+0
|
* include: Convert to stdbool with coccinelleDaniel Wagner2013-07-231-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is completely generated by set of coccille rules and containts zero manual changes. The rule set is not really beautiful but it does the job. We might miss a few conversions but there should be none accidently wrong converted bool here. The rules are as following: //// Do not compare boolean expressions @@ expression E; symbol TRUE; symbol FALSE; @@ ( E - == TRUE | - TRUE == E + E | - E != TRUE + !E | - TRUE != E + !E | - E == FALSE + !E | - FALSE == E + !E | E - != FALSE | - FALSE != E + E ) //// Convert connman_bool_t to stdbool @@ connman_bool_t x; @@ x = ( - TRUE + true | - FALSE + false ) @@ identifier f; @@ connman_bool_t f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ connman_bool_t f(...) { <... - return FALSE; + return false; ...> } @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, connman_bool_t i, ...) { ... } @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, connman_bool_t i, ...); @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) @@ typedef bool; @@ - connman_bool_t + bool //// Convert gboolean to stdbool @@ gboolean x; @@ x = ( - TRUE + true | - FALSE + false ) // Figure out which function signature will to be fixed... // when we have the defitition @r@ identifier f; parameter list[n] ps; identifier i; @@ f(ps, gboolean i, ...) { ... } // ... and now convert all call sites @@ identifier r.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // Figure out which function signature will to be fixed... // when we have the declaration only @r2@ type T; identifier f; parameter list[n] ps; identifier i; @@ T f(ps, gboolean i, ...); // ... and now convert all call sites @@ identifier r2.f; expression list [r.n] es; @@ f(es, ( - FALSE + false | - TRUE + true ) ,...) // A handfull of the GLib hooks we can't change. Let's remember // all ther positions. // 1. timeouts @k1@ identifier f; position p; typedef gpointer; identifier ptr; @@ static gboolean@p f(gpointer ptr); @k2@ identifier f; position p; identifier ptr; @@ static gboolean@p f(gpointer ptr) { ... } // hash map iterator functions @k3@ identifier f; position p; identifier p1, p2, p3; @@ static gboolean@p f(gpointer p1, gpointer p2, gpointer p3) { ... } // 2. GIOChannel @k4@ identifier f; position p; typedef GIOChannel, GIOCondition; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr); @k5@ identifier f; position p; identifier ptr; identifier ch, cn; @@ static gboolean@p f(GIOChannel *ch, GIOCondition cn, gpointer ptr) { ... } // 3. GSourceFuncs @k6@ identifier f; position p; typedef GSource; identifier src; @@ static gboolean@p f(GSource *src, ...) { ... } // gdbus functions @k7@ identifier f; position p; typedef DBusConnection; identifier con; @@ static gboolean@p f(DBusConnection *con, ...) { ... } // Now convert all gboolean which are are not used for interactin // with GLib // Note here happens the magic! @@ typedef bool; position p != {k1.p,k2.p,k3.p,k4.p,k5.p,k6.p,k7.p}; @@ - gboolean@p + bool // Update all return types @@ identifier f; @@ bool f(...) { <... - return TRUE; + return true; ...> } @@ identifier f; @@ bool f(...) { <... - return FALSE; + return false; ...> } //// Last last rule is to fixup all missed call sites. In theory we should //// fixed them with some rules above but somehow coccinelle does not //// match. @@ identifier f =~ "^(__)?connman_.*" ; @@ f(..., ( - FALSE + false | - TRUE + true ) ,...)
* shared/util: Move cb_data_new() helpers to util headerDaniel Wagner2013-07-021-17/+0
| | | | | The helper doesn't really belong to the session.h and ELL also does define the helper in util.h header.
* session: Add session identification method to configDaniel Wagner2013-05-311-0/+9
| | | | | | 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.
* session: Do not fail when creating default policy configurationDaniel Wagner2013-04-181-1/+1
| | | | | Do not handle the small alloc failures because glib will abort when memory is tight anyway.
* session: Change to "func_t" postfix to callback typedefDaniel Wagner2013-04-181-2/+2
| | | | Streamline the callback typedefs with the rest of the code.
* session: Add callback helpersDaniel Wagner2013-03-251-0/+17
| | | | | | | | | | There is a common pattern when writing a callback function. Let's add a few helper for this. It is added to session.h because apart from the core also the session_policy_local.c will make use of it. This is shamelessly stolen from oFono.
* session: Return error code from callbackDaniel Wagner2012-12-051-1/+1
| | | | | In the case the callback is directly called we can use the return value to provide it to the user.
* session: Factor out set default config helperDaniel Wagner2012-11-231-0/+1
| | | | | | Whenever a configuration gets invalid (e.g. a configuration is removed) then we need to be able to drop back to the default configutation.
* session: Export session parsing functionsDaniel Wagner2012-11-231-0/+4
| | | | We want to reuse these functions.
* session: Add getter for session ownerDaniel Wagner2012-11-231-0/+2
|
* session: Add destroy function for pluginsDaniel Wagner2012-11-231-0/+1
| | | | | | | | 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.
* session: Add sessions config update functionDaniel Wagner2012-11-231-0/+2
| | | | | | | | | 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.
* session: Remove struct connman_session_bearerDaniel Wagner2012-11-051-7/+0
| | | | Instead start using enum connman_service_type directly.
* session: Remove match_all from connman_session_bearerDaniel Wagner2012-11-051-1/+0
| | | | | The match_all will be expressed through CONNMAN_SESSION_TYPE_UNKNOWN. The 'no match' case happens when allowed_bearers is NULL.
* session: Remove name variable from connman_session_bearerDaniel Wagner2012-11-051-1/+0
| | | | | | | 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.
* session: Add callback to policy create()Daniel Wagner2012-11-051-2/+7
| | | | | | | 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.
* session: Move the default config create part back to coreDaniel Wagner2012-10-021-0/+2
|
* session: Enforce correct ConnectionType settingsDaniel Wagner2012-09-271-3/+4
| | | | | | 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'.
* session: Add bearer list cleanup functionDaniel Wagner2012-09-271-1/+1
|
* session: Remove unused functionsDaniel Wagner2012-09-271-8/+0
| | | | Basic types are not used for the configuration anymore.
* session: Add callbacks for config creation and distructionDaniel Wagner2012-09-271-0/+3
| | | | | | | | | Whenever a new session is created, the core will ask the plugin the create the config. This config can then be used by the core to enforce the user settings. The owner ship of this config stays in the plugin. Therefore, the plugin will destroy is later.
* session: Allow plugin access to connman_session_allowed_bearers_anyDaniel Wagner2012-09-271-0/+2
|
* session: Move configuration bits to a public structDaniel Wagner2012-09-271-0/+23
| | | | | | Instead of passing basic datatypes between the session core and the policy plugin, provide a complex data structure which holds the session configuration.
* session: Move bearer_info to session.hDaniel Wagner2012-09-271-0/+7
| | | | | Rename bearer_info to connman_session_bearer. Use also 'bearer' as local variable instead of 'info' to avoid confusion with session_info.
* session: Use session pointer instead of string idDaniel Wagner2012-09-271-7/+6
| | | | | | | Instead of passing in some string to identify we can use the connman_session pointer. This allows us to keep the way sessions are identfied away from the core, e.g. using the D-Bus owner id or something else.
* session: Move struct connman_session to session.hDaniel Wagner2012-09-271-0/+2
|
* session: Add plugin priorityDaniel Wagner2012-09-271-0/+5
| | | | | Support several session configuration plugins at runtime. Set the default priority to low for the current policy plugin.
* session: Rename session_config to session_policyDaniel Wagner2012-09-271-3/+3
|
* session: Add configuration pluginDaniel Wagner2012-08-301-0/+52