appSmack_interface.h File Reference

#include "legato.h"
#include "le_limit_interface.h"

Go to the source code of this file.

Macros

#define APPSMACK_MAX_LABEL_LEN   255
 

Enumerations

enum  appSmack_AccessFlags_t { APPSMACK_ACCESS_FLAG_READ = 0x1, APPSMACK_ACCESS_FLAG_WRITE = 0x2, APPSMACK_ACCESS_FLAG_EXECUTE = 0x4 }
 

Functions

void appSmack_ConnectService (void)
 
le_result_t appSmack_TryConnectService (void)
 
void appSmack_DisconnectService (void)
 
void appSmack_GetLabel (const char *appName, char *label, size_t labelNumElements)
 
void appSmack_GetAccessLabel (const char *appName, appSmack_AccessFlags_t accessMode, char *label, size_t labelNumElements)
 

Detailed Description

Legato Application SMACK API include file.

Macro Definition Documentation

#define APPSMACK_MAX_LABEL_LEN   255

Maximum length of SMACK labels.

Enumeration Type Documentation

Access flags.

Function Documentation

void appSmack_ConnectService ( void  )

Connect the current client thread to the service providing this API. Block until the service is available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

void appSmack_DisconnectService ( void  )

Disconnect the current client thread from the service providing this API.

Normally, this function doesn't need to be called. After this function is called, there's no longer a connection to the service, and the functions in this API can't be used. For details, see Client-specific Functions.

This function is created automatically.

void appSmack_GetAccessLabel ( const char *  appName,
appSmack_AccessFlags_t  accessMode,
char *  label,
size_t  labelNumElements 
)

Get's the application's SMACK label with the access mode appended to it as a string. For example, if the accessMode is ACCESS_FLAG_READ | ACCESS_FLAG_WRITE then "rw" will be appended to the application's SMACK label. If the accessMode is 0 (empty) then "-" will be appended to the app's SMACK label.

Note
The application need not be installed for this function to succeed.
Warning
This function will kill the client if there is an error.
Parameters
[in]appNameApplication name
[in]accessModeAccess mode flags
[out]labelSMACK label for the application
[in]labelNumElements
void appSmack_GetLabel ( const char *  appName,
char *  label,
size_t  labelNumElements 
)

Gets the application's SMACK label.

Note
The app doesn't need to be installed for this function to succeed.
Warning
This function will kill the client if there is an error.
Parameters
[in]appNameApplication name
[out]labelSMACK label for the application
[in]labelNumElements
le_result_t appSmack_TryConnectService ( void  )

Try to connect the current client thread to the service providing this API. Return with an error if the service is not available.

For each thread that wants to use this API, either ConnectService or TryConnectService must be called before any other functions in this API. Normally, ConnectService is automatically called for the main thread, but not for any other thread. For details, see Client-specific Functions.

This function is created automatically.

Returns
  • LE_OK if the client connected successfully to the service.
  • LE_UNAVAILABLE if the server is not currently offering the service to which the client is bound.
  • LE_NOT_PERMITTED if the client interface is not bound to any service (doesn't have a binding).
  • LE_COMM_ERROR if the Service Directory cannot be reached.