MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsAdminGetServerSettings

Function cupsAdminGetServerSettings

cups/adminutil.c:97–403  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

95 */
96
97int /* O - 1 on success, 0 on failure */
98cupsAdminGetServerSettings(
99 http_t *http, /* I - Connection to server or @code CUPS_HTTP_DEFAULT@ */
100 int *num_settings, /* O - Number of settings */
101 cups_option_t **settings) /* O - Settings */
102{
103 int i; /* Looping var */
104 cups_file_t *cupsd; /* cupsd.conf file */
105 char cupsdconf[1024]; /* cupsd.conf filename */
106 int remote; /* Remote cupsd.conf file? */
107 http_status_t status; /* Status of getting cupsd.conf */
108 char line[1024], /* Line from cupsd.conf file */
109 *value; /* Value on line */
110 cups_option_t *setting; /* Current setting */
111 _cups_globals_t *cg = _cupsGlobals(); /* Global data */
112
113
114 /*
115 * Range check input...
116 */
117
118 if (!http)
119 {
120 /*
121 * See if we are connected to the same server...
122 */
123
124 if (cg->http)
125 {
126 /*
127 * Compare the connection hostname, port, and encryption settings to
128 * the cached defaults; these were initialized the first time we
129 * connected...
130 */
131
132 if (strcmp(cg->http->hostname, cg->server) ||
133 cg->ipp_port != httpAddrPort(cg->http->hostaddr) ||
134 (cg->http->encryption != cg->encryption &&
135 cg->http->encryption == HTTP_ENCRYPTION_NEVER))
136 {
137 /*
138 * Need to close the current connection because something has changed...
139 */
140
141 httpClose(cg->http);
142 cg->http = NULL;
143 }
144 }
145
146 /*
147 * (Re)connect as needed...
148 */
149
150 if (!cg->http)
151 {
152 if ((cg->http = httpConnect2(cupsServer(), ippPort(), NULL, AF_UNSPEC,
153 cupsEncryption(), 1, 0, NULL)) == NULL)
154 {

Callers 5

do_config_serverFunction · 0.85
do_menuFunction · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 15

_cupsGlobalsFunction · 0.85
httpAddrPortFunction · 0.85
httpCloseFunction · 0.85
httpConnect2Function · 0.85
cupsServerFunction · 0.85
ippPortFunction · 0.85
cupsEncryptionFunction · 0.85
_cupsSetErrorFunction · 0.85
get_cupsd_confFunction · 0.85
cupsFileOpenFunction · 0.85
_cupsLangStringFunction · 0.85
cupsLangDefaultFunction · 0.85

Tested by 1

mainFunction · 0.68