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

Function load_ippserver_attributes

tools/ippeveprinter.c:4247–4298  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4245 */
4246
4247static ipp_t * /* O - IPP attributes or `NULL` on error */
4248load_ippserver_attributes(
4249 const char *servername, /* I - Server name or `NULL` for default */
4250 int serverport, /* I - Server port number */
4251 const char *filename, /* I - ippserver attribute filename */
4252 cups_array_t *docformats) /* I - document-format-supported values */
4253{
4254 ipp_t *attrs; /* IPP attributes */
4255 _ipp_vars_t vars; /* IPP variables */
4256 char temp[256]; /* Temporary string */
4257
4258
4259 (void)docformats; /* for now */
4260
4261 /*
4262 * Setup callbacks and variables for the printer configuration file...
4263 *
4264 * The following additional variables are supported:
4265 *
4266 * - SERVERNAME: The host name of the server.
4267 * - SERVERPORT: The default port of the server.
4268 */
4269
4270 _ippVarsInit(&vars, (_ipp_fattr_cb_t)ippserver_attr_cb, (_ipp_ferror_cb_t)ippserver_error_cb, (_ipp_ftoken_cb_t)ippserver_token_cb);
4271
4272 if (servername)
4273 {
4274 _ippVarsSet(&vars, "SERVERNAME", servername);
4275 }
4276 else
4277 {
4278 httpGetHostname(NULL, temp, sizeof(temp));
4279 _ippVarsSet(&vars, "SERVERNAME", temp);
4280 }
4281
4282 snprintf(temp, sizeof(temp), "%d", serverport);
4283 _ippVarsSet(&vars, "SERVERPORT", temp);
4284
4285 /*
4286 * Load attributes and values for the printer...
4287 */
4288
4289 attrs = _ippFileParse(&vars, filename, NULL);
4290
4291 /*
4292 * Free memory and return...
4293 */
4294
4295 _ippVarsDeinit(&vars);
4296
4297 return (attrs);
4298}
4299
4300
4301/*

Callers 1

mainFunction · 0.85

Calls 5

_ippVarsInitFunction · 0.85
_ippVarsSetFunction · 0.85
httpGetHostnameFunction · 0.85
_ippFileParseFunction · 0.85
_ippVarsDeinitFunction · 0.85

Tested by

no test coverage detected