;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file uses dynamic docstrings, first added in Emacs 19.29. ;;; This file does not contain utf-8 non-ASCII characters, ;;; and so can be loaded in Emacs versions earlier than 23. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\305\306\307\310\311\312\313\302&\210\314\315\316\317\313\306\320\321&\210\314\322\323\324\313\306\320\321&\210\314\325\326\327\313\306\320\321&\210\314\330\316\331\313\306\320\321&\210\314\332\333\334\313\306\320\321&\210\314\335\336\337\313\306\320\321&\210\314\340\341\342\313\306\320\321&\210\314\343\344\345\313\306\320\321&\210\314\346\347\350\313\306\320\321&\210\314\351\352\353\313\306\320\321&\210\314\354\355\356\313\306\320\321&\207" [require enwc-backend enwc dbus subr-x custom-declare-group enwc-nm nil "*NetworkManager variables for ENWC" :prefix "enwc-nm-" :group custom-declare-variable enwc-nm-dbus-service "org.freedesktop.NetworkManager" "NetworkManager D-Bus service." :type string enwc-nm-dbus-path "/org/freedesktop/NetworkManager" "The default D-Bus path for NetworkManager." enwc-nm-dbus-settings-path "/org/freedesktop/NetworkManager/Settings" "The settings D-Bus path for NetworkManager." enwc-nm-dbus-interface "The default D-Bus interface for NetworkManager." enwc-nm-dbus-wireless-interface "org.freedesktop.NetworkManager.Device.Wireless" "The wireless D-Bus interface for NetworkManager." enwc-nm-dbus-wired-interface "org.freedesktop.NetworkManager.Device.Wired" "The wired D-Bus interface for NetworkManager." enwc-nm-dbus-device-interface "org.freedesktop.NetworkManager.Device" "The device D-Bus interface for NetworkManager." enwc-nm-dbus-accesspoint-interface "org.freedesktop.NetworkManager.AccessPoint" "The access point D-Bus interface for NetworkManager." enwc-nm-dbus-settings-interface "org.freedesktop.NetworkManager.Settings" "The settings D-Bus interface for NetworkManager." enwc-nm-dbus-connections-interface "org.freedesktop.NetworkManager.Settings.Connection" "The connections D-Bus interface for NetworkManager." enwc-nm-dbus-active-interface "org.freedesktop.NetworkManager.Connection.Active" "The active connection D-Bus interface for NetworkManager."] 8) (defconst enwc-nm-dbus-settings-groups '(("802-11-wireless-security" "name" "key-mgmt" "wep-tx-keyidx" "auth-alg" "proto" "pairwise" "group" "leap-username" "wep-key0" "wep-key1" "wep-key2" "wep-key3" "wep-key-type" "psk" "leap-password") ("ipv4" "addresses" "dns"))) #@31 The wired device object path. (defvar enwc-nm-wired-dev nil (#$ . 2663)) #@34 The wireless device object path. (defvar enwc-nm-wireless-dev nil (#$ . 2742)) #@38 The active access point object path. (defvar enwc-nm-active-ap nil (#$ . 2827)) #@46 Whether or not NetworkManager is connecting. (defvar enwc-nm-connecting-p nil (#$ . 2913)) #@41 Whether or not NetworkManager is wired. (defvar enwc-nm-wired-p nil (#$ . 3010)) #@58 The information for the network connection being edited. (defvar enwc-nm-edit-info nil (#$ . 3097)) #@56 D-Bus signal object for the "AccessPointAdded" signal. (defvar enwc-nm-access-point-added-signal nil (#$ . 3203)) #@58 D-Bus signal object for the "AccessPointRemoved" signal. (defvar enwc-nm-access-point-removed-signal nil (#$ . 3323)) #@57 D-Bus signal object for the "PropertiesChanged" signal. (defvar enwc-nm-properties-changed-signal nil (#$ . 3447)) #@73 D-Bus signal object for the "StateChanged" signal for the wired device. (defvar enwc-nm-wired-state-changed-signal nil (#$ . 3568)) #@73 D-Bus signal object for the "StateChanged" signal for the default path. (defvar enwc-nm-state-changed-signal nil (#$ . 3706)) (defalias 'enwc-nm-dbus-call-method #[(method &optional path interface &rest args) "\204 \n\204\f \306\307\310\f\n \311\312 & \207" [path enwc-nm-dbus-path interface enwc-nm-dbus-interface enwc-nm-dbus-service method apply dbus-call-method :system :timeout 25000 args] 10]) (defalias 'enwc-nm-dbus-default-call-method #[(method &rest args) "\302\303\304\211 %\207" [method args apply enwc-nm-dbus-call-method nil] 6]) (defalias 'enwc-nm-dbus-settings-call-method #[(method &rest args) "\304\305 \n %\207" [method enwc-nm-dbus-settings-path enwc-nm-dbus-settings-interface args apply enwc-nm-dbus-call-method] 6]) (defalias 'enwc-nm-dbus-wireless-call-method #[(method &rest args) "\304\305 \n %\207" [method enwc-nm-wireless-dev enwc-nm-dbus-wireless-interface args apply enwc-nm-dbus-call-method] 6]) (defalias 'enwc-nm-dbus-wired-call-method #[(method &rest args) "\304\305 \n %\207" [method enwc-nm-wired-dev enwc-nm-dbus-wired-interface args apply enwc-nm-dbus-call-method] 6]) #@40 Get the connection settings from CONN. (defalias 'enwc-nm-get-settings #[(conn) "\302\303 #\207" [conn enwc-nm-dbus-connections-interface enwc-nm-dbus-call-method "GetSettings"] 4 (#$ . 4832)]) #@23 List the connections. (defalias 'enwc-nm-list-connections #[nil "\300\301!\207" [enwc-nm-dbus-settings-call-method "ListConnections"] 2 (#$ . 5033)]) (defalias 'enwc-nm-get-device-by-name #[(name) "\301\302\303#\207" [name enwc-nm-dbus-default-call-method "GetDeviceByIpIface" :string] 4]) #@44 Get the connection that corresponds to NW. (defalias 'enwc-nm--ap-to-conn #[(nw) "\306\307\310\"!\311\312\313\"\314 \315\211\203^\f@\316 !\306\317\320 \"! <\203O \236 \203@\241\210\202KB\211 B*\202V\321  #\210*\fA\211\204*\322 \n\"*\207" [nw profile-table ap-ssid conn --dolist-tail-- settings dbus-byte-array-to-string enwc-nm-get-wireless-network-property "Ssid" make-hash-table :test equal enwc-nm-list-connections nil enwc-nm-get-settings enwc-nm-get-dbus-dict-entry "802-11-wireless/ssid" map--put map-elt #1=#:key #2=#:p #3=#:v] 5 (#$ . 5330)]) #@48 Return non-nil if CONN is a connection object. (defalias 'enwc-nm-connection-p #[(conn) "\205 ;\205 \301\302\"\207" [conn string-match "^/org/freedesktop/NetworkManager/Settings/[0-9]+$"] 3 (#$ . 5925)]) #@44 Return non-nil if CONN is a wired profile. (defalias 'enwc-nm--profile-wired-p #[(conn) "\302!\303\304 \"\305\230)\207" [conn props enwc-nm-get-settings enwc-nm-get-dbus-dict-entry "connection/type" "802-3-ethernet"] 3 (#$ . 6140)]) (defalias 'enwc-nm-get-networks #[(&optional wired) "\203\301 \207\302 \207" [wired enwc-nm-get-wired-profiles enwc-nm-get-wireless-networks] 1]) #@100 The NetworkManager get networks function. This returns a list of D-Bus paths to the access points. (defalias 'enwc-nm-get-wireless-networks #[nil "\300\301!\207" [enwc-nm-dbus-wireless-call-method "GetAccessPoints"] 2 (#$ . 6531)]) (defalias 'enwc-nm-get-wired-profiles #[nil "\301 \302\303\")\207" [profs-list enwc-nm-list-connections cl-remove-if-not enwc-nm--profile-wired-p] 3]) #@97 The NetworkManager connect function. This gets the connection path from NW, and connects to it. (defalias 'enwc-nm-connect #[(nw &optional wired) "\203\302 !\207\303 !\207" [wired nw enwc-nm-wired-connect enwc-nm-wireless-connect] 2 (#$ . 6922)]) (defalias 'enwc-nm-wireless-connect #[(nw) "\303!\211\205\304\305\306 \306\n\306 &)\207" [nw conn enwc-nm-wireless-dev enwc-nm--ap-to-conn enwc-nm-dbus-default-call-method "ActivateConnection" :object-path] 9]) (defalias 'enwc-nm-wired-connect #[(nw) "\302\303\304\304 \304&\207" [nw enwc-nm-wired-dev enwc-nm-dbus-default-call-method "ActivateConnection" :object-path] 8]) (defalias 'enwc-nm-disconnect #[(&optional wired) "\203\301 \207\302 \207" [wired enwc-nm-wired-disconnect enwc-nm-disconnect-wireless] 1]) (defalias 'enwc-nm-disconnect-wireless #[nil "\302\303 #\207" [enwc-nm-wireless-dev enwc-nm-dbus-device-interface enwc-nm-dbus-call-method "Disconnect"] 4]) (defalias 'enwc-nm-wired-disconnect #[nil "\302\303 #\207" [enwc-nm-wired-dev enwc-nm-dbus-device-interface enwc-nm-dbus-call-method "Disconnect"] 4]) #@35 The NetworkManager scan function. (defalias 'enwc-nm-scan #[(&optional wired) "\203 \202 \n\203 \202\f \306\307 \310$*\207" [wired enwc-nm-wired-dev enwc-nm-wireless-dev enwc-nm-dbus-wired-interface enwc-nm-dbus-wireless-interface interface enwc-nm-dbus-call-method "RequestScan" (:array :signature "{sv}") dev] 5 (#$ . 8013)]) #@276 The NetworkManager get wireless network property function. This runs like normal, using element ID of `enwc-access-points' to determine the access point path, then obtains the property PROP from that access point. It also sets the channel from the frequency if necessary. (defalias 'enwc-nm-get-wireless-network-property #[(nw prop) "\304\305 \n %\207" [enwc-nm-dbus-service nw enwc-nm-dbus-accesspoint-interface prop dbus-get-property :system] 6 (#$ . 8361)]) #@42 Convert a frequency FREQ into a channel. (defalias 'enwc-nm--freq-to-channel #[(freq) "\301Z\302\245T\207" [freq 2412 5] 2 (#$ . 8832)]) #@48 Get the network properties for the network NW. (defalias 'enwc-nm-get-wireless-nw-props #[(nw) "\304\305 \n$\306\307\310\311 \"A!B\312\310\313 \"AB\314\310\315 \"AB\316\317 !\206&\320B\321\322\310\323 \"A!B\257)\207" [enwc-nm-dbus-service nw enwc-nm-dbus-accesspoint-interface props dbus-get-all-properties :system essid dbus-byte-array-to-string assoc "Ssid" bssid "HwAddress" strength "Strength" encrypt enwc-nm-get-encryption-type "Unsecured" channel enwc-nm--freq-to-channel "Frequency"] 9 (#$ . 8976)]) #@164 The NetworkManager get encryption type function. This gets the WPA flags and RSN flags from access point in NW. If both are 0, then it returns WEP, otherwise WPA. (defalias 'enwc-nm-get-encryption-type #[(nw) "\303\304\"\303\305\"\211\306U\203 \306U\203\307\202\310*\207" [nw rsn-flags wpa-flags enwc-nm-get-wireless-network-property "WpaFlags" "RsnFlags" 0 "WEP" "WPA"] 5 (#$ . 9495)]) (defalias 'enwc-nm-get-wired-nw-props #[(nw) "\302!\303\304\305 \")BC\207" [nw settings enwc-nm-get-settings name enwc-nm-get-dbus-dict-entry "connection/id"] 4]) (defalias 'enwc-nm-get-nw-props #[(nw &optional wired-p) "\203\302 !\207\303 !\207" [wired-p nw enwc-nm-get-wired-nw-props enwc-nm-get-wireless-nw-props] 2]) #@84 Called when network properties are changed. PROPS is a list of updated properties. (defalias 'enwc-nm-wireless-prop-changed #[(props) "\303\304\"\211\205 A@@\211)\207" [props ap enwc-nm-active-ap assoc "ActiveAccessPoint"] 4 (#$ . 10224)]) #@101 The NetworkManager get current network id function. This simply checks for the active access point. (defalias 'enwc-nm-get-current-nw-id #[(wired) "\203\300\207 \302\230\203\303\207 \207" [wired enwc-nm-active-ap "/" nil] 2 (#$ . 10476)]) #@135 Called when NetworkManager's state is changed. STATE is the new state If STATE is 40, then NetworkManager is connecting to a new AP. (defalias 'enwc-nm-prop-changed #[(state) "\302=\211\207" [state enwc-nm-connecting-p 40] 2 (#$ . 10727)]) #@47 The NetworkManager check connecting function. (defalias 'enwc-nm-check-connecting #[nil "\207" [enwc-nm-connecting-p] 1 (#$ . 10976)]) (defalias 'enwc-nm-dev-prop-changed #[(new-state old-state reason) "\302=\211\207" [new-state enwc-nm-wired-p 100] 2]) (defalias 'enwc-nm-is-wired #[nil "\207" [enwc-nm-wired-p] 1]) #@18 Generate a UUID. (defalias 'enwc-nm-gen-uuid #[nil "\300\301!\210\302\303\304\305\306\307\310\311\"\"#\207" [random t apply format "%04x%04x-%04x-%04x-%04x-%04x%04x%04x" mapcar #[(x) "\300\301!\207" [random 65535] 2] number-sequence 0 7] 8 (#$ . 11303)]) #@76 Get a standard integer from hex string STR starting at ST and ending st ED (defalias 'enwc-nm--hex-substring '(macro . #[(str st ed) "\303\304 \nF\305BB\207" [str st ed string-to-number substring (16)] 5 (#$ . 11564)])) #@76 Convert an address ADDR from an integer in network byte order to a string. (defalias 'enwc-nm-convert-addr #[(addr) "\203\250\203\303\304\"\305\306\307\310\311\312#\"\313\303\314\n#*\207\315\207" [addr hex-addr subs format "%08x" mapcar #[(n) "\302 \211\303\\O\304\"\207" [hex-addr n string-to-number 2 16] 5] number-sequence 6 0 -2 apply "%i.%i.%i.%i" ""] 6 (#$ . 11791)]) #@60 Convert an IP address ADDR in dots notation to an integer. (defalias 'enwc-nm-addr-back #[(addr) ";\204 \303\304\305\300E\"\210\306\307\"\310\311\312\313\314\"\"\315\316\n\"*\207" [addr bytes byte-string signal wrong-type-argument string split-string "\\." mapcar #[(n) "\302\303 8!\304_\"\207" [n bytes lsh string-to-number 8] 4] number-sequence 0 3 apply logior] 5 (#$ . 12181)]) #@164 Get an entry ENTRY from D-Bus dictionary DICT. ENTRY is in the form LVL1/LVL2/.../LVLN, where each LVLi is a string representing another layer in the dictionary. (defalias 'enwc-nm-get-dbus-dict-entry #[(entry dict) ";\204 \305\306\307\300E\"\210 <\204\305\306\310 \301E\"\210\311\312\" \313\f\203=\f\211A\242\314\n \"\211\203# A@\202# \205C @+\207" [entry dict cur-str cur-ent ent-strs signal wrong-type-argument string list split-string "/" nil assoc] 6 (#$ . 12578)]) #@59 Look in DICT for ENTRIES, and set the final one to VALUE. (defalias 'enwc-nm--recurse-dbus-entry #[(dict value entries) "\204 \n\240\207@\305 \"\211\204/ \306\232\203# \307B\240\210\202* \310BC\244\210\305 \"\311\fA@\nA#*\207" [entries dict value cur-str cur-ent assoc (nil) ((nil)) ((nil)) enwc-nm--recurse-dbus-entry] 5 (#$ . 13073)]) #@52 Set entry ENTRY in D-Bus dictionary DICT to VALUE. (defalias 'enwc-nm-set-dbus-dict-entry #[(entry dict value) ";\204 \303\304\305\300E\"\210 <\204\303\304\306 \301E\"\210\307 \n\310\311\"#\207" [entry dict value signal wrong-type-argument string list enwc-nm--recurse-dbus-entry split-string "/"] 6 (#$ . 13431)]) #@70 Convert a D-Bus dictionary entry DICT-ENT from SETTINGS to an alist. (defalias 'enwc-nm-convert-dict-list #[(dict-ent settings) "\302\303\304 \"A@\"\207" [dict-ent settings mapcar #[(ent) "\301@!A@@B\207" [ent intern] 2] assoc] 5 (#$ . 13758)]) #@41 Get security information from SETTINGS. (defalias 'enwc-nm-get-sec-info #[(settings) "\301\302\303\"\302\304\"\"\207" [settings append enwc-nm-convert-dict-list "802-11-wireless-security" "802-1x"] 5 (#$ . 14012)]) #@45 Convert PAIR into a D-Bus dictionary entry. (defalias 'enwc-nm-pair-to-dbus-dict-ent #[(pair) "@A\303\304\n\305 F*D\207" [pair var str :dict-entry :string :variant] 5 (#$ . 14235)]) #@40 Convert ALIST into a D-Bus dictionary. (defalias 'enwc-nm-alist-to-dbus-dict #[(alist) "\304\305\306 \304\211\203 @\307\310\311\n!# A\211\204\f\304*\")\207" [dict alist pr --dolist-tail-- nil append (:array) apply list enwc-nm-pair-to-dbus-dict-ent] 8 (#$ . 14427)]) (defalias 'enwc-nm-process-profile-info #[(settings prof-info) "\306\211\2036\n@\307\306\f\203.\f\211A\242\310 \311\312 @!Q A#\203\306\211\204*\nA\211\204\306 *\207" [prof-info ent --dolist-tail-- cur-ent ent-list settings nil ("802-11-wireless-security" "ipv4") enwc-nm-set-dbus-dict-entry "/" symbol-name] 6]) (defalias 'enwc-nm-alist-to-dbus-str-str-var-map-map #[(alist) "\304 \304\211\203# @\305\306\307\nA@!EB\310B A\211\204\n\304+\207" [ret alist ent --dolist-tail-- nil :string (car ent) enwc-nm-alist-to-dbus-dict :dict-entry] 5]) #@152 Set up all of the D-BUS types of a settings list SETTINGS. This will place all of the necessary markers in the list, such as :array, :dict-entry, etc. (defalias 'enwc-nm-finalize-settings #[(settings) "\301\302!B\207" [settings :array enwc-nm-alist-to-dbus-str-str-var-map-map] 3 (#$ . 15286)]) #@200 Set up NetworkManager settings. Get the current network properties of network CONN and uses the information in the association list SETTINGS to put it in the form that NetworkManager will recognize. (defalias 'enwc-nm-setup-settings #[(conn settings wired) "\306\307 !\203\310 !\202>\311\312!\210\313 !\210\314\315 \316\"!\n\203%\317\202&\320\321\322\f\323PCD\324\325 CD\326\327 CDFDC*\330 \"\331!\210\313!\210\332!)\207" [conn-settings conn wired type ssid settings nil enwc-nm-connection-p enwc-nm-get-settings message "Not a connection" print dbus-byte-array-to-string enwc-nm-get-wireless-network-property "Ssid" "802-3-ethernet" "802-11-wireless" "connection" "id" " settings" "uuid" enwc-nm-gen-uuid ("autoconnect" (nil)) "type" enwc-nm-process-profile-info pp enwc-nm-finalize-settings] 6 (#$ . 15589)]) #@41 Save network AP with settings SETTINGS. (defalias 'enwc-nm-save-nw-settings #[(ap settings wired) "\306!\307 !\210 \203\310\311 \n\312 \f#$\202$\310\313 \f\312 \f#$)\207" [ap conn enwc-nm-dbus-connections-interface settings wired enwc-nm-dbus-settings-path enwc-nm--ap-to-conn print enwc-nm-dbus-call-method "Update" enwc-nm-setup-settings "AddConnection" enwc-nm-dbus-settings-interface] 8 (#$ . 16421)]) #@36 Setup the NetworkManager back-end. (defalias 'enwc-nm-load #[nil "\306!\306\n!\307\310\f \311\312&\307\310\f \313\312&\314\310\f \315%\211\316\230\2031\316\2023)\307\310\f \317\320&\314\310\f\321%\322=\307\310\f \323\324& \314\310\f \321%\325=!\307\310\f\323\326&\211\"\207" [enwc-wired-device enwc-nm-wired-dev enwc-wireless-device enwc-nm-wireless-dev enwc-nm-dbus-service enwc-nm-dbus-wireless-interface enwc-nm-get-device-by-name dbus-register-signal :system "AccessPointAdded" enwc-process-scan "AccessPointRemoved" dbus-get-property "ActiveAccessPoint" "/" "PropertiesChanged" enwc-nm-wireless-prop-changed "State" 40 "StateChanged" enwc-nm-dev-prop-changed 100 enwc-nm-prop-changed enwc-nm-access-point-added-signal enwc-nm-access-point-removed-signal cur-net enwc-nm-active-ap enwc-nm-properties-changed-signal enwc-nm-dbus-path enwc-nm-dbus-interface enwc-nm-connecting-p enwc-nm-dbus-device-interface enwc-nm-wired-state-changed-signal enwc-nm-wired-p enwc-nm-state-changed-signal] 8 (#$ . 16841)]) #@94 Unload the NetworkManager back-end. Unregister all of the D-Bus signals set up during load. (defalias 'enwc-nm-unload #[nil "\305!\210\305 !\210\305\n!\210\305 !\210\305\f!\207" [enwc-nm-access-point-added-signal enwc-nm-access-point-removed-signal enwc-nm-properties-changed-signal enwc-nm-wired-state-changed-signal enwc-nm-state-changed-signal dbus-unregister-object] 2 (#$ . 17899)]) (defalias 'enwc-nm-can-load-p #[nil "\302\303 #\207" [enwc-nm-dbus-service enwc-nm-dbus-path dbus-introspect :system] 4]) (byte-code "\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316& !\210\317\320!\207" [enwc-register-backend record enwc-backend nm enwc-nm-can-load-p enwc-nm-load enwc-nm-unload enwc-nm-get-networks enwc-nm-scan enwc-nm-get-nw-props enwc-nm-connect enwc-nm-disconnect enwc-nm-get-current-nw-id enwc-nm-check-connecting enwc-nm-is-wired provide enwc-nm] 15)