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