static NWCCODE ncp_log_physical_record64(NWCONN_HANDLE conn, u_int32_t fh, ncp_off64_t startOffset, u_int64_t length, unsigned int flags, unsigned int timeout) { NWCCODE err; ncp_init_request(conn); ncp_add_byte(conn, 67); ncp_add_dword_lh(conn, flags); ncp_add_dword_lh(conn, fh); ncp_add_qword_hl(conn, startOffset); ncp_add_qword_hl(conn, length); ncp_add_dword_hl(conn, timeout); err = ncp_request(conn, 87); ncp_unlock_conn(conn); return err; }
void ncp_add_handle_path(struct ncp_buf *conn, nuint32 volNumber, nuint32 dirNumber, int handleFlag, const char *path) { ncp_add_byte(conn, volNumber); ncp_add_dword_lh(conn, dirNumber); ncp_add_byte(conn, handleFlag); if (path) { ncp_add_byte(conn, 1); /* 1 component */ ncp_add_pstring(conn, path); } else { ncp_add_byte(conn, 0); } }
NWCCODE ncp_ns_search_entry_set(NWCONN_HANDLE conn, unsigned int search_attributes, const char* pattern, unsigned int datastream, u_int32_t rim, int* more, size_t *itemcount, struct ncp_search_seq* seq, void* buffer, size_t* size) { size_t slen; NWCCODE result; ncp_init_request(conn); ncp_add_byte(conn, 0x14); ncp_add_byte(conn, seq->name_space); ncp_add_byte(conn, datastream); ncp_add_word_lh(conn, search_attributes); ncp_add_dword_lh(conn, rim); ncp_add_word_lh(conn, *itemcount); ncp_add_mem(conn, &seq->s, 9); slen = pattern ? strlen(pattern) : 0; ncp_add_byte(conn, slen); if (slen) ncp_add_mem(conn, pattern, slen); result = ncp_request(conn, 0x57); if (result) { ncp_unlock_conn(conn); return result; } if (conn->ncp_reply_size < 9 + 1 + 2) { ncp_unlock_conn(conn); return NWE_INVALID_NCP_PACKET_LENGTH; } memcpy(&seq->s, ncp_reply_data(conn, 0), 9); *more = ncp_reply_byte(conn, 9); *itemcount = ncp_reply_word_lh(conn, 10); slen = conn->ncp_reply_size - 9 - 1 - 2; if (slen > *size) { slen = *size; result = NWE_BUFFER_OVERFLOW; } else *size = slen; memcpy(buffer, ncp_reply_data(conn, 12), slen); ncp_unlock_conn(conn); return result; }
static NWCCODE ncp_clear_release_physical_record64(NWCONN_HANDLE conn, u_int32_t fh, ncp_off64_t startOffset, u_int64_t length, int release) { NWCCODE err; ncp_init_request(conn); if (release) { ncp_add_byte(conn, 68); } else { ncp_add_byte(conn, 69); } ncp_add_dword_lh(conn, fh); ncp_add_qword_hl(conn, startOffset); ncp_add_qword_hl(conn, length); err = ncp_request(conn, 87); ncp_unlock_conn(conn); return err; }