Attach a service through the first subsystem that recognizes it.
| 3412 | |
| 3413 | // Attach a service through the first subsystem that recognizes it. |
| 3414 | ISC_STATUS API_ROUTINE isc_service_attach(ISC_STATUS* userStatus, USHORT serviceLength, |
| 3415 | const TEXT* serviceName, isc_svc_handle* publicHandle, USHORT spbLength, const SCHAR* spb) |
| 3416 | { |
| 3417 | StatusVector status(userStatus); |
| 3418 | CheckStatusWrapper statusWrapper(&status); |
| 3419 | YService* service = NULL; |
| 3420 | |
| 3421 | try |
| 3422 | { |
| 3423 | nullCheck(publicHandle, isc_bad_svc_handle); |
| 3424 | |
| 3425 | if (!serviceName) |
| 3426 | status_exception::raise(Arg::Gds(isc_service_att_err) << Arg::Gds(isc_svc_name_missing)); |
| 3427 | |
| 3428 | string svcName(serviceName, serviceLength ? serviceLength : fb_strlen(serviceName)); |
| 3429 | |
| 3430 | RefPtr<Dispatcher> dispatcher(FB_NEW Dispatcher); |
| 3431 | |
| 3432 | dispatcher->setDbCryptCallback(&statusWrapper, TLS_GET(legacyCryptCallback)); |
| 3433 | if (status.getState() & IStatus::STATE_ERRORS) |
| 3434 | return status[1]; |
| 3435 | |
| 3436 | service = dispatcher->attachServiceManager(&statusWrapper, svcName.c_str(), |
| 3437 | spbLength, reinterpret_cast<const UCHAR*>(spb)); |
| 3438 | if (status.getState() & IStatus::STATE_ERRORS) |
| 3439 | return status[1]; |
| 3440 | |
| 3441 | *publicHandle = service->getHandle(); |
| 3442 | } |
| 3443 | catch (const Exception& e) |
| 3444 | { |
| 3445 | if (service) |
| 3446 | { |
| 3447 | StatusVector temp(NULL); |
| 3448 | CheckStatusWrapper tempCheckStatusWrapper(&temp); |
| 3449 | service->detach(&tempCheckStatusWrapper); |
| 3450 | } |
| 3451 | |
| 3452 | e.stuffException(&statusWrapper); |
| 3453 | } |
| 3454 | |
| 3455 | return status[1]; |
| 3456 | } |
| 3457 | |
| 3458 | |
| 3459 | // Close down a service. |
nothing calls this directly
no test coverage detected