| 4811 | |
| 4812 | |
| 4813 | ISC_STATUS rem_port::open_blob(P_OP op, P_BLOB* stuff, PACKET* sendL) |
| 4814 | { |
| 4815 | /************************************** |
| 4816 | * |
| 4817 | * o p e n _ b l o b |
| 4818 | * |
| 4819 | ************************************** |
| 4820 | * |
| 4821 | * Functional description |
| 4822 | * Open or create a new blob. |
| 4823 | * |
| 4824 | **************************************/ |
| 4825 | Rtr* transaction; |
| 4826 | LocalStatus ls; |
| 4827 | CheckStatusWrapper status_vector(&ls); |
| 4828 | |
| 4829 | getHandle(transaction, stuff->p_blob_transaction); |
| 4830 | |
| 4831 | Rdb* rdb = this->port_context; |
| 4832 | if (bad_db(&status_vector, rdb)) |
| 4833 | { |
| 4834 | return this->send_response(sendL, 0, 0, &status_vector, false); |
| 4835 | } |
| 4836 | |
| 4837 | ULONG bpb_length = 0; |
| 4838 | const UCHAR* bpb = NULL; |
| 4839 | |
| 4840 | if (op == op_open_blob2 || op == op_create_blob2) |
| 4841 | { |
| 4842 | bpb_length = stuff->p_blob_bpb.cstr_length; |
| 4843 | bpb = stuff->p_blob_bpb.cstr_address; |
| 4844 | } |
| 4845 | |
| 4846 | ServBlob iface(op == op_open_blob || op == op_open_blob2 ? |
| 4847 | rdb->rdb_iface->openBlob(&status_vector, transaction->rtr_iface, |
| 4848 | &stuff->p_blob_id, bpb_length, bpb) : |
| 4849 | rdb->rdb_iface->createBlob(&status_vector, transaction->rtr_iface, |
| 4850 | &sendL->p_resp.p_resp_blob_id, bpb_length, bpb)); |
| 4851 | |
| 4852 | USHORT object = 0; |
| 4853 | if (!(status_vector.getState() & IStatus::STATE_ERRORS)) |
| 4854 | { |
| 4855 | Rbl* blob = FB_NEW Rbl(BLOB_LENGTH); |
| 4856 | #ifdef DEBUG_REMOTE_MEMORY |
| 4857 | printf("open_blob(server) allocate blob %x\n", blob); |
| 4858 | #endif |
| 4859 | blob->rbl_blob_id = stuff->p_blob_id; |
| 4860 | blob->rbl_iface = iface; |
| 4861 | blob->rbl_rdb = rdb; |
| 4862 | if (blob->rbl_id = this->get_id(blob)) |
| 4863 | { |
| 4864 | object = blob->rbl_id; |
| 4865 | blob->rbl_rtr = transaction; |
| 4866 | transaction->rtr_blobs.add(blob); |
| 4867 | } |
| 4868 | else |
| 4869 | { |
| 4870 | blob->rbl_iface->cancel(&status_vector); |
no test coverage detected