provider_info.h File Reference

Provider information util APIs. More...


Defines

#define PROVIDER_INFO_MAXPREFIXLEN   64
 Maximum length of the provider prefix string.
#define PROVIDER_INFO_EXTERNAL   0
 Provider info indicates the application is an external one.
#define PROVIDER_INFO_INTERNAL   1
 Provider info indicates the application is an internal one.

Functions

int provider_info_is_external (void)
 Check if the current application is an external one.
int provider_info_is_external_by_pid (pid_t pid)
 Check if a particular application is an external one.
int provider_info_is_external_by_path (const char *path)
 Check if a particular application is an external one.
int provider_info_is_external_by_provider_id (provider_id_t provider_id)
 Check if the provider ID is an external one.
const char * provider_info_get_prefix (void)
 Retrieves the provider prefix associated with the current process.
const char * provider_info_get_prefix_by_pid (pid_t pid)
 Retrieves the provider prefix associated with a particular process.
int provider_info_get_prefix_by_path (const char *path, char *buf, size_t bufsz)
 Get the provider prefix assigned to a specific path.
int provider_info_get_provider_prefix_from_provider_id (provider_id_t provider_id, char *buf, size_t size)
 Retrieve the provider prefix associated with the given provider ID.
int provider_info_get_provider_id (provider_id_t *provider_id_p)
 Retrieves the provider ID associated with the current process.
int provider_info_get_provider_id_by_pid (pid_t pid, provider_id_t *provider_id_p)
 Retrieves the provider ID associated with a particular process.
int provider_info_get_provider_id_by_path (const char *path, provider_id_t *provider_id_p)
 Get the provider ID assigned to a specific path.
int provider_info_get_provider_id_from_provider_prefix (const char *provider_prefix, provider_id_t *provider_id_p)
 Retrieves the provider ID associated with the given provider prefix.
const char * provider_info_get_install_dir (void)
 Retrieves the install dir associated with the current process.
const char * provider_info_get_storage_dir (void)
 Retrieves the persistent storage location associated with the provider ID of the current process.


Detailed Description

Provider information util APIs.

These functions allow users to get provider-specific information, such as the provider id and prefix.


Function Documentation

const char* provider_info_get_install_dir void   ) 
 

Retrieves the install dir associated with the current process.

This function builds the install dir of the current process, and returns it as a const char pointer.

Returns:
The install dir associated with the process; otherwise returns NULL

const char* provider_info_get_prefix void   ) 
 

Retrieves the provider prefix associated with the current process.

This function reads the provider prefix of the current process, and returns it as a const char pointer.

Returns:
The provider prefix associated with the process; otherwise returns NULL
See also:
provider_info_get_prefix_by_pid

int provider_info_get_prefix_by_path const char *  path,
char *  buf,
size_t  bufsz
 

Get the provider prefix assigned to a specific path.

Parameters:
[in] path Path to obtain devid from
[out] buf Buffer to store provider prefix
[in] bufsz Size of the buffer
Returns:
0 on success; -1 on error

const char* provider_info_get_prefix_by_pid pid_t  pid  ) 
 

Retrieves the provider prefix associated with a particular process.

This function reads the provider prefix of the process specified in pid, and returns it as a const char pointer.

Parameters:
[in] pid Process ID of the particular process
Returns:
provider prefix associated with the process; otherwise returns NULL

int provider_info_get_provider_id provider_id_t *  provider_id_p  ) 
 

Retrieves the provider ID associated with the current process.

This function reads the provider ID of the current process and returns it as an unsigned 16-bit integer.

Parameters:
[out] provider_id_p Pointer to place to store provider ID
Returns:
-1 on error; 0 otherwise errno will be set to one of the following values:
  • EINVAL Invalid argument
  • ERANGE Number is larger than the maximum allowed value
See also:
provider_info_get_provider_id_by_pid

int provider_info_get_provider_id_by_path const char *  path,
provider_id_t *  provider_id_p
 

Get the provider ID assigned to a specific path.

Parameters:
[in] path Path to obtain provider ID from
[out] provider_id_p Pointer to place to store provider ID
Returns:
-1 on error; 0 otherwise errno will be set to one of the following values:
  • EINVAL Invalid argument

int provider_info_get_provider_id_by_pid pid_t  pid,
provider_id_t *  provider_id_p
 

Retrieves the provider ID associated with a particular process.

This function reads the provider ID of the process specified in pid and returns it as an unsigned 16-bit integer.

Parameters:
[in] pid Process ID of the particular process
[out] provider_id_p Pointer to place to store provider ID
Returns:
-1 on error; 0 otherwise errno will be set to one of the following values:
  • EINVAL Invalid argument
  • ERANGE Number is larger than the maximum allowed value

int provider_info_get_provider_id_from_provider_prefix const char *  provider_prefix,
provider_id_t *  provider_id_p
 

Retrieves the provider ID associated with the given provider prefix.

Parameters:
[in] provider_prefix Provider prefix
[out] provider_id_p Pointer to place to store provider ID
Returns:
0 on success; -1 on error errno will be set to one of the following values:
  • EINVAL Invalid argument
  • EBADF Invalid file
  • EOPNOTSUPP Cannot read from the file

int provider_info_get_provider_prefix_from_provider_id provider_id_t  provider_id,
char *  buf,
size_t  size
 

Retrieve the provider prefix associated with the given provider ID.

Parameters:
[in] provider_id Provider ID
[out] buf Buffer to store provider prefix
[in] size Size of the buffer
Returns:
0 on success; -1 on error errno will be set to one of the following values:
  • EINVAL Invalid argument
  • EBADF Invalid file
  • EOPNOTSUPP Cannot read from the file

const char* provider_info_get_storage_dir void   ) 
 

Retrieves the persistent storage location associated with the provider ID of the current process.

Returns:
The persistent storage location associated with the provider ID of the current process; otherwise returns NULL

int provider_info_is_external void   ) 
 

Check if the current application is an external one.

Returns:
  • PROVIDER_INFO_EXTERNAL External application
  • PROVIDER_INFO_INTERNAL Internal application
See also:
provider_info_is_external_by_pid

int provider_info_is_external_by_path const char *  path  ) 
 

Check if a particular application is an external one.

Parameters:
[in] path of the application
Returns:
  • PROVIDER_INFO_EXTERNAL External application
  • PROVIDER_INFO_INTERNAL Internal application
See also:
provider_info_is_external_by_pid

int provider_info_is_external_by_pid pid_t  pid  ) 
 

Check if a particular application is an external one.

Parameters:
[in] pid Process ID of the particular process
Returns:
  • PROVIDER_INFO_EXTERNAL External application
  • PROVIDER_INFO_INTERNAL Internal application
See also:
provider_info_is_external

int provider_info_is_external_by_provider_id provider_id_t  provider_id  ) 
 

Check if the provider ID is an external one.

Returns:
  • PROVIDER_INFO_EXTERNAL External application
  • PROVIDER_INFO_INTERNAL Internal application


2007-2009 Juniper Networks, Inc. All rights reserved. The information contained herein is confidential information of Juniper Networks, Inc., and may not be used, disclosed, distributed, modified, or copied without the prior written consent of Juniper Networks, Inc. in an express license. This information is subject to change by Juniper Networks, Inc. Juniper Networks, the Juniper Networks logo, and JUNOS are registered trademarks of Juniper Networks, Inc. in the United States and other countries. All other trademarks, service marks, registered trademarks, or registered service marks are the property of their respective owners.
Generated on Sun May 30 20:24:56 2010 for libprovider by Doxygen 1.4.5