yumapro  21.10T-10
YumaPro SDK
File Utilities

Wrappers to standard Linux file system APIs. More...

Collaboration diagram for File Utilities:

Functions

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_tncx_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...
 

Detailed Description

Wrappers to standard Linux file system APIs.

These functions often used to have consistent error messages.

Function Documentation

◆ ncx_buffer_to_file()

status_t ncx_buffer_to_file ( const char *  filespec,
const xmlChar *  inbuff 
)

Write a buffer to a text file.

Parameters
filespecfile to write
inbuffinput text buffer, zero terminated
Returns
status
Here is the call graph for this function:

◆ 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_buffsource buffer
src_bufflenlength of buffer (does not assume z-term string
dst_filespecdestination filespec
Returns
status
Here is the call graph for this function:

◆ ncx_file_close()

void ncx_file_close ( FILE *  fp)

Close a file; check result.

Parameters
fpFile pointer to close
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_file_copy()

status_t ncx_file_copy ( const xmlChar *  src_filespec,
const xmlChar *  dst_filespec 
)

Copy a file; check result.

Parameters
src_filespecsource filespec
dst_filespecdestination filespec
Returns
status
Here is the call graph for this function:

◆ ncx_file_remove()

status_t ncx_file_remove ( const xmlChar *  filespec,
boolean  do_warn 
)

Close a file; check result.

Parameters
filespecname of filespec to remove
do_warnTRUE for warning if remove failed
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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_filespecname of filespec to rename
new_filespecnew name of filespec
do_warnTRUE for warning if rename failed
Returns
status
Here is the call graph for this function:

◆ ncx_file_size()

status_t ncx_file_size ( const char *  filespec,
uint32 *  siz 
)

Get a file size.

Parameters
filespecfile to check
sizaddress of return size
Return values
*sizfile contents size in bytes
Returns
status
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ncx_file_to_buffer()

status_t ncx_file_to_buffer ( const char *  filespec,
xmlChar **  outbuff 
)

Read a text file into a malloced buffer.

Parameters
filespecfile to read
outbuffaddress of return buffer
Return values
*outbuffset to the malloced buffer; need to free with m__free
Returns
status
See also
ncx_buffer_to_file
Here is the call graph for this function:

◆ ncx_free_modcache()

void ncx_free_modcache ( ncx_modcache_t mc)

Free a ncx_modcache_t record.

Parameters
mcmodcache to free

◆ 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
buffbuffer to fill with the temporary filespec
bufflenlength of buff
rootpartstart of filename
extextension (may be NULL)
Returns
status
Here is the call graph for this function:

◆ 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
modnamemodule name to add
hidemodtrue 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
fdSocket Descriptor (given in the socket open) to close
Here is the call graph for this function:
Here is the caller graph for this function:

◆ 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
fdSocket Descriptor (given in the socket open) to close
Here is the call graph for this function: