Lines Matching defs:svc

49 	service_t *svc = app_data;
51 if (svc != NULL)
52 result = svc->authCB(svc, svc->app_data);
102 service_load(service_t *svc, char *name)
107 if (svc->so_handle != NULL) /* already loaded */
114 svc->attributes = getprinterbyname((char *)name, NULL);
116 if (svc->attributes != NULL) {
120 papiAttributeListGetString(svc->attributes, NULL,
123 svc->name = strdup(tmp);
126 if (uri_from_string(svc->name, &svc->uri) != -1)
127 scheme = (svc->uri)->scheme;
130 papiAttributeListGetString(svc->attributes, NULL,
136 result = psm_open(svc, scheme);
143 detailed_error(svc, "Unable to load service for: %s", name);
147 detailed_error(svc, "Unable to load service (%s) for: %s",
155 service_send_peer(service_t *svc)
159 if ((svc->peer_fd != -1) && (svc->so_handle != NULL) &&
160 (svc->svc_handle != NULL)) {
163 f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetPeer");
166 result = f(svc->svc_handle, svc->peer_fd);
173 service_connect(service_t *svc, char *name)
178 if (svc->so_handle == NULL)
179 result = service_load(svc, name);
180 else if ((svc->name == NULL) && (name != NULL))
181 svc->name = strdup(name);
187 if (svc->so_handle != NULL) {
190 if (svc->svc_handle != NULL) /* already connected? */
193 f = (papi_status_t (*)())psm_sym(svc, "papiServiceCreate");
196 char *user = svc->user;
197 char *password = svc->password;
200 if ((user == NULL) && (svc->uri != NULL))
201 user = (svc->uri)->user;
203 if ((password == NULL) && (svc->uri != NULL))
204 password = (svc->uri)->password;
206 result = f(&svc->svc_handle, svc->name, user, password,
207 (svc->authCB ? interposed_auth_callback
209 svc->encryption, svc);
210 (void) service_send_peer(svc);
220 int (*authCB)(papi_service_t svc, void *app_data),
224 service_t *svc = NULL;
230 if ((*handle = svc = calloc(1, sizeof (*svc))) == NULL)
233 svc->peer_fd = -1;
236 svc->user = strdup(user_name);
239 svc->password = strdup(password);
241 svc->encryption = encryption;
244 svc->authCB = authCB;
247 svc->app_data = app_data;
254 result = service_load(svc, service_name);
255 /* if the psm loaded and the svc contains a URI, connect */
256 if ((result == PAPI_OK) && (svc->uri != NULL))
257 result = service_connect(svc, service_name);
268 service_t *svc = handle;
270 if (svc->so_handle != NULL) {
271 if (svc->svc_handle != NULL) {
274 f = (void (*)())psm_sym(svc,
276 f(svc->svc_handle);
278 psm_close(svc->so_handle);
280 if (svc->attributes != NULL)
281 papiAttributeListFree(svc->attributes);
282 if (svc->name != NULL)
283 free(svc->name);
284 if (svc->user != NULL)
285 free(svc->user);
286 if (svc->password != NULL)
287 free(svc->password);
288 if (svc->uri != NULL)
289 uri_free(svc->uri);
301 service_t *svc = handle;
303 svc->peer_fd = fd;
304 result = service_send_peer(svc);
317 service_t *svc = handle;
320 if (svc->user != NULL)
321 free(svc->user);
323 svc->user = strdup(user_name);
324 f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetUserName");
326 result = f(svc->svc_handle, user_name);
339 service_t *svc = handle;
342 if (svc->password != NULL)
343 free(svc->password);
345 svc->password = strdup(password);
346 f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetPassword");
348 result = f(svc->svc_handle, password);
361 service_t *svc = handle;
364 svc->encryption = encryption;
365 f = (papi_status_t (*)())psm_sym(svc,
368 result = f(svc->svc_handle, encryption);
377 int (*authCB)(papi_service_t svc, void *app_data))
382 service_t *svc = handle;
385 svc->authCB = authCB;
386 f = (papi_status_t (*)())psm_sym(svc, "papiServiceSetAuthCB");
388 result = f(svc->svc_handle, interposed_auth_callback);
402 service_t *svc = handle;
405 svc->app_data = (void *)app_data;
418 service_t *svc = handle;
421 f = (char *(*)())psm_sym(svc, "papiServiceGetServiceName");
423 result = f(svc->svc_handle);
425 result = svc->name;
437 service_t *svc = handle;
440 f = (char *(*)())psm_sym(svc, "papiServiceGetUserName");
442 result = f(svc->svc_handle);
444 result = svc->user;
456 service_t *svc = handle;
459 f = (char *(*)())psm_sym(svc, "papiServiceGetPassword");
461 result = f(svc->svc_handle);
463 result = svc->password;
475 service_t *svc = handle;
478 f = (papi_encryption_t (*)())psm_sym(svc,
481 result = f(svc->svc_handle);
483 result = svc->encryption;
493 service_t *svc = handle;
496 result = svc->app_data;
505 service_t *svc = handle;
510 if (svc->so_handle == NULL) {
513 if (service_connect(svc, uri) != PAPI_OK)
517 f = (papi_attribute_t **(*)())psm_sym(svc,
520 result = f(svc->svc_handle);
522 result = svc->attributes;
531 service_t *svc = handle;
536 f = (char *(*)())psm_sym(svc, "papiServiceGetStatusMessage");
538 result = f(svc->svc_handle);
541 papiAttributeListGetString(svc->attributes, NULL,
549 detailed_error(service_t *svc, char *fmt, ...)
551 if ((svc != NULL) && (fmt != NULL)) {
566 papiAttributeListAddString(&svc->attributes, PAPI_ATTR_APPEND,