How to query the originating hostname from the C API?

pipitas k1pfeifle at gmx.net
Mon Jan 22 19:15:17 PST 2007


Kurt Pfeifle wrote:

>> > Hi,
>> >
>> > I maintain a simple in-house monitoring application. I would like
>> > to extended the list of queued jobs to display the origination
>> > hostname.
>> > In the web GUI this is quite easily done by extending the template
>> > file, but apparently that function is not exported to the C API, at
>> > least I can't find a field in cups_jobs_t.
>> >
>> > Any idea how to achieve this?
>> >
>> > Regards,
>> >   Dominik
>>
>> You need not extend the CGIs for that.
>> Add {job_originating_host_name} in jobs.tmpl where appropriate.
>>
>> Cheers,
>> Opher Shachar.
> 
> Heh :-)  ... he said he knew how to do it in the web GUI. He wanted to do
> it via the C API.
> 
> I'm not sure if the C API provides hooks for that -- but in any case, the
> "c000NNN" control files in "/var/spool/cups/" do hold this info.
> 
> He could use brute force and run "strings -A 1 job-originating-host-name"
> against such a c-file, or he could build and run the "ipptest" utility
> ("test" subdirectory), and run it like this:
> 
>    cd test ;
>    ./ipptest -v ipp://localhost:631/jobs/1737 get-job-attributes.test
>    |grep job-originating-host-name
> 
> to get info about job ID 1737.


Or even more simple, use the "testipp" utility that gets build in the
"cups" subdir:

     /path/to/.../cups/testipp /var/spool/cups/c01737 | grep job-originating-host-name





More information about the cups mailing list