provider_info.h File Reference

Provider information util APIs. More...


Data Structures

struct  provider_info_origin_description_s
 Description of packing format used in origin ID. 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.

Typedefs

typedef u_int32_t provider_package_id_t
 A type definition for Package ID.
typedef u_int32_t provider_program_id_t
 A type definition for Program ID.
typedef provider_info_origin_description_s provider_info_origin_description_t
 Description of packing format used in origin ID.

Functions

int provider_info_build_origin_id (provider_origin_id_t *origin_id_p, provider_id_t provider_id, provider_package_id_t package_id, provider_program_id_t program_id, provider_info_origin_description_t origin_description)
 Build the origin ID from the provider ID, package ID and the program ID.
provider_package_id_t provider_info_get_package_id_from_origin_id (provider_origin_id_t origin_id, provider_info_origin_description_t origin_description)
 Get the package ID from a given origin ID.
provider_program_id_t provider_info_get_program_id_from_origin_id (provider_origin_id_t origin_id, provider_info_origin_description_t origin_description)
 Get the program ID from a given origin ID.
provider_id_t provider_info_get_provider_id_from_origin_id (provider_origin_id_t origin_id, provider_info_origin_description_t origin_description)
 Get the provider ID from a given origin ID.
int provider_info_get_origin_id (provider_origin_id_t *origin_id_p)
 Retrieves the origin ID associated with the current process.
int provider_info_get_origin_id_by_pid (pid_t pid, provider_origin_id_t *origin_id_p)
 Retrieves the origin ID associated with a particular process.
int provider_info_get_origin_id_by_path (const char *path, provider_origin_id_t *origin_id_p)
 Get the origin ID assigned to a specific path.
int provider_info_get_program_name_from_program_id (provider_package_id_t package_id, provider_program_id_t program_id, char *buf, size_t size)
 Retrieve the program name associated with the given program ID.
int provider_info_get_package_name_from_package_id (provider_package_id_t package_id, char *buf, size_t size)
 Retrieve the package name associated with the given package ID.
int provider_info_get_package_id_from_package_name (const char *package_name, provider_package_id_t *package_id_p)
 Retrieves the package ID associated with the given package name.
int provider_info_get_package_name (char *pkg_name, size_t size)
 Retrieves the package name associated with the current process.
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

int provider_info_build_origin_id provider_origin_id_t *  origin_id_p,
provider_id_t  provider_id,
provider_package_id_t  package_id,
provider_program_id_t  program_id,
provider_info_origin_description_t origin_description  __unused
 

Build the origin ID from the provider ID, package ID and the program ID.

Parameters:
[out] origin_id_p Buffer to store the origin ID
[in] provider_id Provider ID
[in] package_id Package ID
[in] program_id Program ID
[in] origin_description Description of the origin ID layout
Returns:
0 on success; -1 on error

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

int provider_info_get_origin_id provider_origin_id_t *  origin_id_p  ) 
 

Retrieves the origin ID associated with the current process.

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

Parameters:
[out] origin_id_p Pointer to place to store origin ID
Returns:
-1 on error; 0 otherwise
See also:
provider_info_get_origin_id_by_pid

int provider_info_get_origin_id_by_path const char *  path,
provider_origin_id_t *  origin_id_p
 

Get the origin ID assigned to a specific path.

Parameters:
[in] path Path to obtain origin ID from
[out] origin_id_p Pointer to place to store origin ID
Returns:
0 on success; -1 on error errno will be set to one of the following values:
  • EINVAL Invalid argument
  • ERANGE Obtained origin ID is larger than the maximum allowed

int provider_info_get_origin_id_by_pid pid_t  pid,
provider_origin_id_t *  origin_id_p
 

Retrieves the origin ID associated with a particular process.

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

Parameters:
[in] pid Process ID of the particular process
[out] origin_id_p Pointer to place to store origin ID
Returns:
-1 on error; 0 otherwise

provider_package_id_t provider_info_get_package_id_from_origin_id provider_origin_id_t  origin_id,
provider_info_origin_description_t origin_description  __unused
 

Get the package ID from a given origin ID.

Parameters:
[in] origin_id Origin ID from which the package ID is extracted
[in] origin_description Description of the origin ID layout
Returns:
package ID associated with the given origin ID

int provider_info_get_package_id_from_package_name const char *  package_name,
provider_package_id_t package_id_p
 

Retrieves the package ID associated with the given package name.

Parameters:
[in] package_name Name of the package
[out] package_id_p Pointer to place to store package 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_package_name char *  pkg_name,
size_t  size
 

Retrieves the package name associated with the current process.

Parameters:
[out] pkg_name Buffer to store the package name
[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
Deprecated:
This API has been replaced by provider_package_get_name() and will be removed in JUNOS 10.3.

int provider_info_get_package_name_from_package_id provider_package_id_t  package_id,
char *  buf,
size_t  size
 

Retrieve the package name associated with the given package ID.

Parameters:
[in] package_id Package 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_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

provider_program_id_t provider_info_get_program_id_from_origin_id provider_origin_id_t  origin_id,
provider_info_origin_description_t origin_description  __unused
 

Get the program ID from a given origin ID.

Parameters:
[in] origin_id Origin ID from which the program ID is extracted
[in] origin_description Description of the origin ID layout
Returns:
program ID associated with the given origin ID

int provider_info_get_program_name_from_program_id provider_package_id_t  program_id,
provider_program_id_t  package_id,
char *  buf,
size_t  size
 

Retrieve the program name associated with the given program ID.

Parameters:
[in] package_id Package ID
[in] program_id Program 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

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

provider_id_t provider_info_get_provider_id_from_origin_id provider_origin_id_t  origin_id,
provider_info_origin_description_t origin_description  __unused
 

Get the provider ID from a given origin ID.

Parameters:
[in] origin_id Origin ID from which the provider ID is extracted
[in] origin_description Description of the origin ID layout
Returns:
provider ID associated with the given origin ID

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:05 2010 for libprovider by Doxygen 1.4.5