Commit graph

26 commits

Author SHA1 Message Date
Thomas Haller 8bace23beb all: cleanup includes and let "nm-default.h" include "config.h"
- All internal source files (except "examples", which are not internal)
  should include "config.h" first. As also all internal source
  files should include "nm-default.h", let "config.h" be included
  by "nm-default.h" and include "nm-default.h" as first in every
  source file.
  We already wanted to include "nm-default.h" before other headers
  because it might contains some fixes (like "nm-glib.h" compatibility)
  that is required first.

- After including "nm-default.h", we optinally allow for including the
  corresponding header file for the source file at hand. The idea
  is to ensure that each header file is self contained.

- Don't include "config.h" or "nm-default.h" in any header file
  (except "nm-sd-adapt.h"). Public headers anyway must not include
  these headers, and internal headers are never included after
  "nm-default.h", as of the first previous point.

- Include all internal headers with quotes instead of angle brackets.
  In practice it doesn't matter, because in our public headers we must
  include other headers with angle brackets. As we use our public
  headers also to compile our interal source files, effectively the
  result must be the same. Still do it for consistency.

- Except for <config.h> itself. Include it with angle brackets as suggested by
  https://www.gnu.org/software/autoconf/manual/autoconf.html#Configuration-Headers
2016-02-19 17:53:25 +01:00
Thomas Haller 19c3ea948a all: make use of new header file "nm-default.h" 2015-08-05 15:32:40 +02:00
Dan Winship 3452ee2a0e all: rename nm-glib-compat.h to nm-glib.h, use everywhere
Rather than randomly including one or more of <glib.h>,
<glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include
"nm-glib-compat.h" most of the time), rename nm-glib-compat.h to
nm-glib.h, include <gio/gio.h> from there, and then change all .c
files in NM to include "nm-glib.h" rather than including the glib
headers directly.

(Public headers files still have to include the real glib headers,
since nm-glib.h isn't installed...)

Also, remove glib includes from header files that are already
including a base object header file (which must itself already include
the glib headers).
2015-07-24 13:25:47 -04:00
Dan Winship c14486984e libnm, libnm-util: move settings doc generation to libnm-core
Move the settings/plugins doc generation from libnm-util to
libnm-core, since libnm-util isn't being updated for all new
properties.

With this commit, the keyfile and ifcfg-rh documentation is basically
unchanged, except that deprecated properties are now gone, and new
properties have been added, and the sections are in a different order.
(generate-plugin-docs.pl just outputs the settings in Makefile order,
and they were unsorted in libnm-util, but are sorted in libnm-core).

The settings documentation used for nm-settings.5, the D-Bus API docs,
and the nmcli help is changed a bit more at this point, and mostly for
the worse, since the libnm-core setting properties don't match up with
the D-Bus API as well as the libnm-util ones do. To be fixed...

(I also removed the "plugins docs" line in each plugin docs comment
block while moving them, since those blocks will be used for more than
just plugins soon, and it's sort of obvious anyway.)
2014-11-19 09:24:09 -05:00
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 a91e60902e libnm-core: make NMSettingSerial:parity an enum
NMSettingSerial:parity was defined as a char-typed property that could
have the (case-sensitive!) values 'n', 'E', or 'o'. This is zany. Add
an NMSettingSerialParity enum, and use that instead.
2014-10-03 09:36:28 -04: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
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
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 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
Dan Williams d8437ffaf1 core: fix deprecated usage of g_value_[get|set]_char() (bgo #662694) 2011-10-28 11:35:59 -05:00
Dan Williams 55f55781a8 docs: update Serial setting documentation 2011-07-05 18:17:08 -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 71bae14f2c libnm-util: better error message about missing PPP setting 2010-05-26 00:32:05 -07:00
Dan Williams 9a9e833af6 doc: document serial setting properties 2009-11-11 14:07:14 -08: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 3949779389 2008-10-26 Dan Williams <dcbw@redhat.com>
Patch from Tambet Ingo <tambet@gmail.com>

	* libnm-util/libnm-util.ver
	  libnm-util/nm-setting-serial.c
	  libnm-util/nm-setting-serial.h
	  src/nm-serial-device.c
		- Make properties private and use accessors instead



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@4214 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-10-26 16:54:17 +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 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 8774cc756a 2008-01-02 Tambet Ingo <tambet@gmail.com>
* libnm-util/nm-setting-serial.c (nm_setting_serial_class_init):
        * Mark the properties
        with G_PARAM_CONSTRUCT so that they get the default values.

        * src/nm-gsm-device.c: Add preliminary support for monitoring
        * device. It only monitors
        the monitoring device and prints out the output for now. Or more
precicely, doesn't
        do absolutely anything right now since the montoring device
argument is never set.

        * src/nm-serial-device.c (serial_debug): Implement. It's very
        * verbose and thus
        requires it's own knob to turn it on.
        (config_fd): Add NMSettingSerial to the arguments list.
        (nm_serial_device_open): Ditto.
        (get_reply_got_data): Ignore the terminators at the beginning of
the output.
        (nm_serial_device_get_io_channel): Implement.

        * src/nm-manager.c: Add NMDBusManager to the private data of the
        * NMManager. Asking
        a new reference every time (and forgetting to release it
sometimes) is a pain and
        it's not like NMManager could work without dbus.
        (nm_manager_add_device): Register the added device on dbus here.

        * src/nm-hal-manager.c (modem_device_creator): Pass NULL for now
        * for the monitoring
        device.

        * src/nm-device.c (constructor): Don't export the device here,
        * instead export
        it when it's added to the NMManager's device list.




git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3203 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2008-01-02 13:42:52 +00:00
Tambet Ingo db5a10dc4d 2007-11-28 Tambet Ingo <tambet@gmail.com>
Merge the beginnings of the new GSM card support.

        * src/ppp-manager/nm-ppp-manager.c (nm_ppp_manager_stop): Remove
        * the
        ppp watch source before killing pppd - If this happens from
g_object_unref()
        then the ppp manager is already destroyed by the time the watch
callback runs.

        * src/nm-hal-manager.c: Add a device_type_name string to the
        * device
        creators, so that we can print a nice human readable string when
a
        device is added.

        * src/nm-umts-device.c (automatic_registration_get_network):
        * Query
        for the activated network, not much is done with the result
thought.

        * src/nm-serial-device.c (nm_serial_device_get_reply):
        * Implement.
        (ppp_ip4_config): Change the device state to activated here for
now.
        (real_check_connection): Make sure the connection includes ppp
setting.

        * libnm-glib/nm-client.c (get_device): Handle umts devices.

        * libnm-glib/Makefile.am: Add the new files to build.

        * libnm-glib/nm-umts-device.c: 
        * libnm-glib/nm-umts-device.h: Implement.

2007-11-26  Tambet Ingo  <tambet@gmail.com>

        * src/nm-umts-device.c (automatic_registration_get_network): For
        * now, dial
        immediately, nm_serial_device_get_reply() isn't implemented
correctly yet.

        * src/nm-serial-device.c (wait_for_reply_info_destroy): Don't
        * try to remove
        the timeout source - this function is only called when the
timeout source has
        been removed.
        (nm_serial_device_wait_for_reply): Allocate the duplicate
responses array
        to be big enough to contain the terminating zero element as
well.
        The timeout argument is meant to be in seconds now.
        (real_deactivate_quickly): Implement.

        * src/NetworkManager.conf: Allow root to own 
        "org.freedesktop.NetworkManager.PPP", deny it for everybody
else.

        * libnm-util/nm-setting-umts.c: Network type and band properties
        * are ints,
        (not unsigned ints).

        * libnm-util/nm-setting-serial.c (nm_setting_serial_class_init):
        * Fix a 
        small issue with parity bounds - capital letters have lower
ascii codes
        than lower case letters.

        * libnm-util/nm-connection.c (register_default_settings):
        * Register serial
        and umts settings.

2007-11-22  Tambet Ingo  <tambet@gmail.com>

        Remove the "index" property from devices as not all device types
have this.

        * include/NetworkManager.h (NM_DBUS_PATH_DEVICE): Remove.

        * src/nm-hal-manager.c (nm_get_device_index_from_hal): Remove.
        (wired_device_creator): Get the device interface from hal to
create the device.
        (wireless_device_creator): Ditto.

        * src/nm-device.c (nm_device_init): Remove the index member.
        (constructor): Remove the checks for index property, make
interface property
        a require constructor property.
        Use the HAL udi for DBus path for devices.
        (nm_device_get_index): Remove.
        (set_property): Remove index handling.
        (get_property): Ditto.
        (nm_device_get_dbus_path): Remove.

        * src/nm-device-interface.c (nm_device_interface_init): Remove
        * the index
        property.

        * src/nm-device-802-3-ethernet.c
        * (nm_device_802_3_ethernet_link_activated):
        Access the device index through it's interface.
        (nm_device_802_3_ethernet_link_deactivated): Ditto.
        (nm_device_802_3_ethernet_new): Remove the useless argument
test_dev. Remove
        index argument. Add interface argument.

        * src/nm-device-802-11-wireless.c
        * (nm_device_802_11_wireless_new): Remove
        the useless test_dev argument. Remove index argument. Add
interface arugment.

        * src/NetworkManagerSystem.c
        * (nm_system_device_set_from_ip4_config): Get the
        device index through interface.
        (nm_system_set_mtu): Ditto.

        * introspection/nm-device.xml: Remove the "Index" property.

2007-11-21  Tambet Ingo  <tambet@gmail.com>

        * src/nm-serial-device.c: 
        * src/nm-serial-device.c: 
        * src/nm-umts-device.c:
        * src/nm-umts-device.h: Implement.

        * src/nm-hal-manager.c (nm_get_device_driver_name):
        * libhal_free_string the string 
        allocated by libhal.
        (modem_device_creator): Implement.
        (register_built_in_creators): Register the modem creator.

        * src/nm-device-802-11-wireless.c
        * (nm_device_802_11_wireless_new): 
        Remove the unused test_dev argument.

        * src/nm-device-802-3-ethernet.c (nm_device_802_3_ethernet_new):
        * Ditto.

        * src/Makefile.am: Add new files to build.
        Link in ppp-manager.

        * libnm-util/nm-setting-umts.c: 
        * libnm-util/nm-setting-umts.h: 
        * libnm-util/nm-setting-serial.c: 
        * libnm-util/nm-setting-serial.h: Implement.

        * libnm-util/Makefile.am: Add new files to build.



git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@3116 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
2007-11-29 14:38:07 +00:00