Commit graph

49 commits

Author SHA1 Message Date
Dan Winship 3bfb163a74 all: consistently include config.h
config.h should be included from every .c file, and it should be
included before any other include. Fix that.

(As a side effect of how I did this, this also changes us to
consistently use "config.h" rather than <config.h>. To the extent that
it matters [which is not much], quotes are more correct anyway, since
we're talking about a file in our own build tree, not a system
include.)
2014-11-13 17:18:42 -05:00
Dan Winship 2570c5a17c libnm-util, libnm-glib: whitespace fixes
Fix indentation, kill trailing whitespace, split some long lines.
2014-07-15 09:44:55 -04:00
Dan Winship cb7e1893e7 libnm-util, libnm-glib: standardize copyright/license headers
- Remove list of authors from files that had them; these serve no
  purpose except to quickly get out of date (and were only used in
  libnm-util and not libnm-glib anyway).

- Just say "Copyright", not "(C) Copyright" or "Copyright (C)"

- Put copyright statement after the license, not before

- Remove "NetworkManager - Network link manager" from the few files
  that contained it, and "libnm_glib -- Access network status &
  information from glib applications" from the many files that
  contained it.

- Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline
  to files that were missing it.
2014-07-15 09:44:54 -04:00
Dan Winship cdc15cb2a6 libnm-util: remove NMSetting* GParamSpec docs
Remove all the GParamSpec docs, since everything now uses the gtk-doc
docs instead, so there's no point in having two copies of each (which
are often out of sync anyway).

Since we're touching so many lines anyway, also fix up the indentation
of the remaining property-installing lines, and add
G_PARAM_STATIC_STRINGS to each paramspec (so the nick strings don't
get strduped). Also, be consistent about starting a new line between
"g_object_class_install_property" and its opening parenthesis.
2014-06-19 17:45:03 -04:00
Dan Winship e8577083ca libnm-util: various NMSetting* property doc fixes/improvements
Fix up various issues with the docs for the NMSetting properties, and
pull in text from the GParamSpec docs where the GParamSpec docs were
better (or contained information that is necessary in the context of
nm-settings.5).

Also, consistently wrap all of the doc comments to the same width (80
columns).
2014-06-19 17:45:02 -04:00
Dan Winship 9de24b16e8 libnm-util: fix gtk-doc bugs in NMSetting* properties
Fix misused gtk-doc annotations and incorrectly-identified properties.

In particular, the upcoming introspection-based generate-settings-spec
expands macro and enum values, so if you use '%' where you should have
used '#', it will fail to find an expansion, and error out.
2014-06-19 17:45:02 -04:00
Thomas Haller 9d319e6da0 libnm-util: refactor NMSetting name and register_settings
- refactor register_settings to allow lookup by GType and
  add the settings name to SettingInfo.

- setting NM_SETTING_NAME is deprecated and should not be set anymore.
  Indeed it has always be a bug, to reset the name to a different value.
  The only valid place to set the name was in the _init() function of
  the derived class itself.
  This is now no longer needed/possible. Instead the name get's
  detected based on the registered setting types. This makes use of
  the registered metadata that is available anyway since every
  usable setting has to register itself.

Signed-off-by: Thomas Haller <thaller@redhat.com>
2013-12-12 21:47:13 +01:00
Dan Williams 983079cd59 libnm-util: remove usage of NM_SETTING_PARAM_SERIALIZE
The only property that is not serializes is each settings' 'name'
property, so the flag serves no purpose.
2013-12-02 15:26:12 -06:00
Jiří Klimeš 816ac9ee70 libnm-util: prefix errors with 'setting.property' instead of 'property' only 2013-06-13 10:05:18 +02:00
Aleksander Morgado 46853f0821 libnm-util: deprecate 'network-type' and 'allowed-bands' in GSM settings
When requesting connections to ModemManager, NetworkManager shouldn't try to
request specific bands or network types to use. Leave those requests to other
system configuration tools talking directly to ModemManager.

https://bugzilla.gnome.org/show_bug.cgi?id=701504
2013-06-05 12:39:24 -05:00
Jiří Klimeš 5a50e60ac3 libnm-util: define NM_SETTING_GSM_BANDS_MAX - maximal value for allowed bands
and use it in 'allowed-bands' property installation.

The macro NM_SETTING_GSM_BANDS_MAX also allows libnm-util users to check
if bands are valid (before setting them).
2013-05-03 17:23:41 +02:00
Jiří Klimeš c35dda8727 libnm-util: fix the maximal value for gsm 'allowed-bands' property
The bitfields have to be OR-ed with the bitwise |, not ||.
2013-05-03 10:11:56 +02:00
Jiří Klimeš df142a5dc4 libnm-util: make property verification errors more descriptive
- fix g_set_error()/g_set_error_literal() usage
- make the error messages translatable
- use g_prefix_error() to prepend property name
2013-03-13 17:47:11 +01:00
Dan Williams 38e3819b4e libnm-util: clean up setting registration
Make setting type registration less icky; instead of having the
connection register all the settings, have the settings themselves
register that information at library load time.  Putting this sort
of thing in G_DEFINE_TYPE_WITH_CODE is apparently more standard
than the home-rolled stuff we had before.  Also document the
priority stuff so when adding new settings, people know what
priority to use.

(cleanups by jklimes)
2012-10-29 15:12:58 -05:00
Dan Winship 6878d20ac4 all: Don't use ctype.h macros
The ctype macros (eg, isalnum(), tolower()) are locale-dependent. Use
glib's ASCII-only versions instead.

Also, replace isascii() with g_ascii_isprint(), since isascii()
accepts control characters, which isn't what the code wanted in any of
the places where it was using it.
2012-09-26 12:14:37 -04:00
Marius B. Kotsbak c4a85acf80 core: add settings for 4G (LTE) network modes
NM_SETTING_GSM_NETWORK_TYPE_PREFER_4G and NM_SETTING_GSM_NETWORK_TYPE_4G added.
2012-09-11 11:47:22 -05:00
Dan Winship 839eab5564 Use glib-mkenums to generate enum types
Rather than generating enum classes by hand (and complaining in each
file that "this should really be standard"), use glib-mkenums.

Unfortunately, we need a very new version of glib-mkenums in order to
deal with NM's naming conventions and to fix a few other bugs, so just
import that into the source tree temporarily.

Also, to simplify the use of glib-mkenums, import Makefile.glib from
https://bugzilla.gnome.org/654395.

To avoid having to run glib-mkenums for every subdirectory of src/,
add a new "generated" directory, and put the generated enums files
there.

Finally, use Makefile.glib for marshallers too, and generate separate
ones for libnm-glib and NetworkManager.
2012-02-15 11:42:15 -05:00
Thomas Bechtold 3dc965a2cb libnm-util: allow empty number for gsm settings
The documentation said they were allowed, and that's clearly the
correct behavior.
2012-02-02 12:02:10 -06:00
Dan Williams a8256961f6 trivial: fix GSM setting 'home-only' property nickname 2011-10-27 11:24:15 -05:00
Dan Williams 2da074db78 docs: update GSM setting documentation 2011-07-05 14:19:54 -05:00
Aleksander Morgado 33e6997599 libnm-util: added missing U2600 GSM band enumeration 2011-06-13 10:38:32 -05:00
Dan Williams 7b41be489c libnm-util: allow _ as a valid character for GSM APNs
The ETSI specs state that valid characters are only ASCII alphanumeric
characters, but then state that APNs should generally follow DNS
naming rules.  Well, that means a lot more characters are allowed,
but modems don't like many of them.  So let's slowly allow more
characters as people find ones that actually are used.  The restriction
was originally put in place to disallow spaces, because they
certainly aren't allowed APN characters and modems and the
network puke when they see spaces.
2011-05-17 10:49:44 -05:00
Dan Williams 125540471b core: don't require serial and PPP settings for mobile broadband
If they are there, use them.  If not, make them up on the fly.
2011-02-25 11:24:20 -06:00
Dan Williams bad3377131 libnm-util: update CDMA, GSM, and PPPoE settings for NOT_REQUIRED secrets 2011-02-07 19:16:54 -06:00
Dan Williams 899b8a40dc libnm-util: NM_SETTING_SECRET_FLAG_SYSTEM_OWNED -> NM_SETTING_SECRET_FLAG_NONE
Make it a bit clearer that this value is not actually a value that
can be used as a flag, since its 0x00.
2011-02-06 23:37:39 -06:00
Dan Williams 562246cb80 libnm-util: fix handling of secrets flags
It's a bitfield, not a single value.  Update GObject property
max accordingly.
2011-01-31 12:36:53 -06:00
Dan Williams 5a7cf39a62 libnm-util: add secret flags for each secret describing how the secret is stored
This allows the necessary flexibility when handling secrets; otherwise
it wouldn't be known when NM should save secrets returned from agents
to backing storage, or when the agents should store the secrets. We
can't simply use lack of a secret in persistent storage as the indicator
of this, as (for example) when creating a new connection without
secrets the storage method would be abmiguous.

At the same time, fold in "always ask" functionality for OTP tokens
so user agents don't have to store that attribute themselves out-of-band.
2011-01-29 13:34:24 -06:00
Dan Williams 89fcc757a4 libnm-util: remove deprecated GSM bits 2011-01-27 18:38:45 -06:00
Dan Williams 389a297571 libnm-util: silence warning 2010-11-03 14:58:22 -05:00
Dan Williams a1731c6064 libnm-util: fix max APN length
It's not 20, it's DNS domain name length.
2010-09-22 13:44:18 -05:00
Dan Williams 0ec9bf2c73 libnm-util: enforce APN character restrictions
APNs can only contain alphanumeric characters, '.', and '-'.  To be
helpful we strip spaces off before setting the APN internally so that
previously (and incorrectly) valid APNs don't cause the whole
connection to fail validation and thus disappear.  The only case seen
in the wild was a Pelephone IL APN which erroneously had a trailing
space in the mobile broadband provider database.  Bad characters
cause the connection to fail with vague error messages about being
unable to activate the PDP context during PPP negotiation.
2010-09-22 13:20:02 -05:00
Dan Williams d924003320 libnm-util: add nm_setting_gsm_get_home_only()
For roaming control.
2010-03-16 23:52:37 -07:00
Dan Williams 9a5e3bd0b6 doc: document gsm setting properties 2009-11-11 14:06:33 -08:00
Dan Williams a770a14fd2 libnm-util: ensure GSM setting default values
Broken by 00f945e54e.
2009-10-18 22:51:43 -07:00
Dan Williams 00f945e54e gsm: correct GSM band implementation and settings
NM didn't pass it to MM anyway, so it was mainly unused, but the band settings
were still wrong.  Fix that (and still preserve ABI) by adding a new property
for allowed bands that can actually hold all the bands instead of limiting
to 16-bits.  Clean up some of the deprecation stuff at the same time to make
it clearer what's deprecated and what to do about it.
2009-10-07 12:18:57 -07:00
Dan Williams d548fc9a61 libnm-util: silence some of the GSM PUK warnings 2009-09-21 10:59:19 -07:00
Dan Williams e4ed9764b5 libnm-util: deprecate GSM PUK property
Unused anyway, and PUK is dangerous enough that it should be handled
by the client explicitly and not by NM.
2009-09-18 17:08:30 -07:00
Torgny Johansson a736385127 gsm: fix GSM network mode max value
So that you can actually prefer GSM/EDGE.
2009-07-10 07:58:55 -04:00
Dan Williams b61b199776 libnm-util: flag properties with G_PARAM_CONSTRUCT so default values get set
This caused the 'autoconnect' property of NMSettingConnection to not
get updated in some cases (as when a system setting plugin noticed a
change to autoconnect=true and emitted the Updated signal, which wouldn't
contain the new value).  Add a testcase for setting default values too.
2009-02-01 20:18:21 -05:00
Dan Williams c438326110 2008-10-27 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com>

	* libnm-util/nm-setting.h
	  libnm-util/nm-setting.c
		- Make properties private and add accessor functions

	* libnm-util/nm-connection.c
	  libnm-util/nm-setting-8021x.c
	  libnm-util/nm-setting-cdma.c
	  libnm-util/nm-setting-connection.c
	  libnm-util/nm-setting-gsm.c
	  libnm-util/nm-setting-ip4-config.c
	  libnm-util/nm-setting-ip6-config.c
	  libnm-util/nm-setting-ppp.c
	  libnm-util/nm-setting-pppoe.c
	  libnm-util/nm-setting-serial.c
	  libnm-util/nm-setting-template.c
	  libnm-util/nm-setting-vpn.c
	  libnm-util/nm-setting-wired.c
	  libnm-util/nm-setting-wireless-security.c
	  libnm-util/nm-setting-wireless.c
	  system-settings/plugins/keyfile/reader.c
	  system-settings/plugins/keyfile/writer.c
		- Use setting accessors



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4228 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-27 17:36:18 +00:00
Dan Williams 76c366b546 2008-10-26 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com>

	* libnm-util/libnm-util.ver
	  libnm-util/nm-setting-gsm.c
	  libnm-util/nm-setting-gsm.h
		- Make properties private and add accessor functions

	* src/nm-gsm-device.c
	  src/nm-hso-gsm-device.c
	  src/ppp-manager/nm-ppp-manager.c
		- Use those accessors



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4219 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-26 17:23:37 +00:00
Dan Williams 33110acba8 2008-09-27 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-gsm.c
		- (verify): verify GSM network ID



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4118 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-28 03:17:09 +00:00
Dan Williams dbd1e23f13 2008-09-25 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-gsm.c
	  libnm-util/nm-setting-gsm.h
		- Fix up NM_GSM_NETWORK_* constants to accurately reflect the network
			technology terms (bgo #551361)



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4106 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-09-25 16:16:52 +00:00
Dan Williams e2aa087281 2008-08-04 Dan Williams <dcbw@redhat.com>
* libnm-util/nm-setting-cdma.c
	  libnm-util/nm-setting-gsm.c
		- (verify): validate username & password if they exist
		- (need_secrets): if username given, require a password too



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3892 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-08-04 19:17:10 +00:00
Dan Williams 281791ac77 2008-07-27 Dan Williams <dcbw@redhat.com>
* libnm-util/*
		- Relicense to LGPLv2+



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3859 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-07-27 20:03:46 +00:00
Dan Williams 05e9de9402 2008-06-12 Dan Williams <dcbw@redhat.com>
Add a GError argument to nm_connection_verify() and nm_setting_verify(),
	and add error enums to each NMSetting subclass.  Each NMSetting subclass now
	returns a descriptive GError when verification fails.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3751 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-12 23:58:08 +00:00
Dan Williams 99ef193601 2008-06-11 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com>

	* libnm-util/nm-setting-gsm.c
		- (verify): validate APN

	* src/nm-gsm-device.c
		- (manual_registration_done): start setting APN if needed
		- (set_apn, set_apn_done): set the APN
		- (do_dial): use the APN when dialing



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3750 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-06-11 18:08:35 +00:00
Dan Williams 2497bea1d2 2008-01-09 Dan Williams <dcbw@redhat.com>
* src/nm-device.c
	  src/nm-device.h
		- (device_activation_precheck, check_connection_complete): remove this
			virtual function; incomplete connections should be invalid by
			definition, complete-ness should be checked in the setting's
			verify function

	* src/nm-serial-device.c
	  src/nm-gsm-device.c
		- (real_check_connection_complete): remove

	* libnm-util/nm-setting-serial.c
		- (verify): new function; ensure there is a PPP setting too

	* libnm-util/nm-setting-gsm.c
		- (verify): ensure there is a serial setting too



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3225 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-01-09 18:27:23 +00:00
Tambet Ingo 0bd26c1abe 2007-12-10 Tambet Ingo <tambet@gmail.com>
* Replace all occurences of 'UMTS' with 'GSM'.




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3161 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-12-10 09:17:40 +00:00
Renamed from libnm-util/nm-setting-umts.c (Browse further)