Wrappers to standard Linux file system APIs.
More...
|
void | ncx_socket_close (int fd) |
| Close a socket; check result. More...
|
|
void | ncx_socket_close_noerr (int fd) |
| Close a socket; check result; SUPPRESS ERROR MESSAGE. More...
|
|
void | ncx_file_close (FILE *fp) |
| Close a file; check result. More...
|
|
status_t | ncx_file_remove (const xmlChar *filespec, boolean do_warn) |
| Close a file; check result. More...
|
|
status_t | ncx_file_rename (const xmlChar *old_filespec, const xmlChar *new_filespec, boolean do_warn) |
| Rename a file; check result. More...
|
|
status_t | ncx_file_copy (const xmlChar *src_filespec, const xmlChar *dst_filespec) |
| Copy a file; check result. More...
|
|
status_t | ncx_file_buffcopy (const xmlChar *src_buff, uint32 src_bufflen, const xmlChar *dst_filespec) |
| Copy a buffer to a file; check result. More...
|
|
status_t | ncx_file_size (const char *filespec, uint32 *siz) |
| Get a file size. More...
|
|
status_t | ncx_file_to_buffer (const char *filespec, xmlChar **outbuff) |
| Read a text file into a malloced buffer. More...
|
|
status_t | ncx_buffer_to_file (const char *filespec, const xmlChar *inbuff) |
| Write a buffer to a text file. More...
|
|
status_t | ncx_get_temp_filespec (xmlChar *buff, uint32 bufflen, const xmlChar *rootpart, const xmlChar *ext) |
| Generate a temporary filespec. More...
|
|
ncx_modcache_t * | ncx_new_modcache (const xmlChar *modname, boolean hidemod) |
| New ncx_modcache_t record. More...
|
|
void | ncx_free_modcache (ncx_modcache_t *mc) |
| Free a ncx_modcache_t record. More...
|
|
Wrappers to standard Linux file system APIs.
These functions often used to have consistent error messages.
◆ ncx_buffer_to_file()
status_t ncx_buffer_to_file |
( |
const char * |
filespec, |
|
|
const xmlChar * |
inbuff |
|
) |
| |
Write a buffer to a text file.
- Parameters
-
filespec | file to write |
inbuff | input text buffer, zero terminated |
- Returns
- status
◆ ncx_file_buffcopy()
status_t ncx_file_buffcopy |
( |
const xmlChar * |
src_buff, |
|
|
uint32 |
src_bufflen, |
|
|
const xmlChar * |
dst_filespec |
|
) |
| |
Copy a buffer to a file; check result.
- Parameters
-
src_buff | source buffer |
src_bufflen | length of buffer (does not assume z-term string |
dst_filespec | destination filespec |
- Returns
- status
◆ ncx_file_close()
void ncx_file_close |
( |
FILE * |
fp | ) |
|
Close a file; check result.
- Parameters
-
◆ ncx_file_copy()
status_t ncx_file_copy |
( |
const xmlChar * |
src_filespec, |
|
|
const xmlChar * |
dst_filespec |
|
) |
| |
Copy a file; check result.
- Parameters
-
src_filespec | source filespec |
dst_filespec | destination filespec |
- Returns
- status
◆ ncx_file_remove()
status_t ncx_file_remove |
( |
const xmlChar * |
filespec, |
|
|
boolean |
do_warn |
|
) |
| |
Close a file; check result.
- Parameters
-
filespec | name of filespec to remove |
do_warn | TRUE for warning if remove failed |
- Returns
- status
◆ ncx_file_rename()
status_t ncx_file_rename |
( |
const xmlChar * |
old_filespec, |
|
|
const xmlChar * |
new_filespec, |
|
|
boolean |
do_warn |
|
) |
| |
Rename a file; check result.
- Parameters
-
old_filespec | name of filespec to rename |
new_filespec | new name of filespec |
do_warn | TRUE for warning if rename failed |
- Returns
- status
◆ ncx_file_size()
status_t ncx_file_size |
( |
const char * |
filespec, |
|
|
uint32 * |
siz |
|
) |
| |
Get a file size.
- Parameters
-
| filespec | file to check |
[out] | siz | address of return size
- *siz file contents size in bytes
|
- Returns
- status
◆ ncx_file_to_buffer()
status_t ncx_file_to_buffer |
( |
const char * |
filespec, |
|
|
xmlChar ** |
outbuff |
|
) |
| |
Read a text file into a malloced buffer.
- Parameters
-
| filespec | file to read |
[out] | outbuff | address of return buffer
- *outbuff set to the malloced buffer; need to free with m__free
|
- Returns
- status
- See also
- ncx_buffer_to_file
◆ ncx_free_modcache()
◆ ncx_get_temp_filespec()
status_t ncx_get_temp_filespec |
( |
xmlChar * |
buff, |
|
|
uint32 |
bufflen, |
|
|
const xmlChar * |
rootpart, |
|
|
const xmlChar * |
ext |
|
) |
| |
Generate a temporary filespec.
- Parameters
-
buff | buffer to fill with the temporary filespec |
bufflen | length of buff |
rootpart | start of filename |
ext | extension (may be NULL) |
- Returns
- status
◆ ncx_new_modcache()
ncx_modcache_t * ncx_new_modcache |
( |
const xmlChar * |
modname, |
|
|
boolean |
hidemod |
|
) |
| |
New ncx_modcache_t record.
Used by the server only
- Parameters
-
modname | module name to add |
hidemod | true to hide from clients |
- Returns
- modcache record; must free with ncx_free_modcache
◆ ncx_socket_close()
void ncx_socket_close |
( |
int |
fd | ) |
|
Close a socket; check result.
- Parameters
-
fd | Socket Descriptor (given in the socket open) to close |
◆ ncx_socket_close_noerr()
void ncx_socket_close_noerr |
( |
int |
fd | ) |
|
Close a socket; check result; SUPPRESS ERROR MESSAGE.
Any error will be printed as a log_debug2 The client NETCONF over TLS sessions are getting closed before the ncx_socket_close() API is called. This happens at the TLS layer when the server drops the session
- Parameters
-
fd | Socket Descriptor (given in the socket open) to close |