FOSSology
4.4.0
Open Source License Compliance by Open Source Software
|
libfossagent.c contains general use functions for agents. More...
#include "libfossology.h"
Go to the source code of this file.
Functions | |
char * | getUploadTreeTableName (fo_dbManager *dbManager, int uploadId) |
Get the upload tree table name for a given upload. More... | |
PGresult * | queryFileIdsForUpload (fo_dbManager *dbManager, int uploadId, bool ignoreFilesWithMimeType) |
Get all file IDs (pfile_fk) for a given upload. More... | |
char * | queryPFileForFileId (fo_dbManager *dbManager, long fileId) |
Get the pfile name for a given file ID. More... | |
FUNCTION int | fo_GetAgentKey (PGconn *pgConn, const char *agent_name, long Upload_pk, const char *rev, const char *agent_desc) |
Get the latest enabled agent key (agent_pk) from the database. More... | |
FUNCTION int | fo_WriteARS (PGconn *pgConn, int ars_pk, int upload_pk, int agent_pk, const char *tableName, const char *ars_status, int ars_success) |
Write ars record. More... | |
FUNCTION int | fo_CreateARSTable (PGconn *pgConn, const char *tableName) |
Create ars table if it doesn't already exist. More... | |
FUNCTION int | max (int permGroup, int permPublic) |
Get the maximum group privilege. More... | |
FUNCTION int | min (int user_perm, int permExternal) |
Get the minimum permission level required. More... | |
FUNCTION int | getEffectivePermissionOnUpload (PGconn *pgConn, long UploadPk, int user_pk, int user_perm) |
Get users permission to this upload. More... | |
FUNCTION int | GetUploadPerm (PGconn *pgConn, long UploadPk, int user_pk) |
Get users permission to this upload. More... | |
FUNCTION char * | GetUploadtreeTableName (PGconn *pgConn, int upload_pk) |
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree". More... | |
PGresult * | checkDuplicateReq (PGconn *pgConn, int uploadPk, int agentPk) |
Get the upload_pk and agent_pk to find out the agent has already scanned the package. More... | |
PGresult * | getSelectedPFiles (PGconn *pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType) |
Get the upload_pk, agent_pk and ignoreFilesWithMimeType to get all the file Ids for nomos. More... | |
libfossagent.c contains general use functions for agents.
Definition in file libfossagent.c.
PGresult* checkDuplicateReq | ( | PGconn * | pgConn, |
int | uploadPk, | ||
int | agentPk | ||
) |
Get the upload_pk and agent_pk to find out the agent has already scanned the package.
pgConn | Database connection object pointer. |
upload_pk | Upload ID |
agent_pk | agentPk |
Definition at line 442 of file libfossagent.c.
FUNCTION int fo_CreateARSTable | ( | PGconn * | pgConn, |
const char * | tableName | ||
) |
Create ars table if it doesn't already exist.
pgConn | Database connection object pointer. |
tableName | ars table name |
Definition at line 270 of file libfossagent.c.
FUNCTION int fo_GetAgentKey | ( | PGconn * | pgConn, |
const char * | agent_name, | ||
long | Upload_pk, | ||
const char * | rev, | ||
const char * | agent_desc | ||
) |
Get the latest enabled agent key (agent_pk) from the database.
pgConn | Database connection object pointer. |
agent_name | Name of agent to look up. |
Upload_pk | is no longer used. |
rev | Agent revision, if given this is the exact revision of the agent being requested. |
agent_desc | Description of the agent. Used to write a new agent record in the case where no enabled agent records exist for this agent_name. |
Definition at line 158 of file libfossagent.c.
FUNCTION int fo_WriteARS | ( | PGconn * | pgConn, |
int | ars_pk, | ||
int | upload_pk, | ||
int | agent_pk, | ||
const char * | tableName, | ||
const char * | ars_status, | ||
int | ars_success | ||
) |
Write ars record.
If the ars table does not exist, one is created by inheriting the ars_master table. The new table is called {tableName}. For example, "unpack_ars". If ars_pk is zero a new ars record will be created. Otherwise, it is updated.
pgConn | Database connection object pointer. |
ars_pk | If zero, a new record will be created. |
upload_pk | ID of the upload |
agent_pk | Agents should get this from fo_GetAgentKey() |
tableName | ars table name |
ars_status | Status to update ars_status. May be null. |
ars_success | Automatically set to false if ars_pk is zero. |
Definition at line 214 of file libfossagent.c.
FUNCTION int getEffectivePermissionOnUpload | ( | PGconn * | pgConn, |
long | UploadPk, | ||
int | user_pk, | ||
int | user_perm | ||
) |
Get users permission to this upload.
pgConn | Database connection object pointer. |
upload_pk | Upload ID |
user_pk | User ID |
user_perm | Privilege of user |
Definition at line 321 of file libfossagent.c.
PGresult* getSelectedPFiles | ( | PGconn * | pgConn, |
int | uploadPk, | ||
int | agentPk, | ||
bool | ignoreFilesWithMimeType | ||
) |
Get the upload_pk, agent_pk and ignoreFilesWithMimeType to get all the file Ids for nomos.
pgConn | Database connection object pointer. |
upload_pk | uploadPk |
agent_pk | agentPk |
ignoreFilesWithMimeType | To ignore Files With MimeType |
Definition at line 469 of file libfossagent.c.
FUNCTION int GetUploadPerm | ( | PGconn * | pgConn, |
long | UploadPk, | ||
int | user_pk | ||
) |
Get users permission to this upload.
pgConn | Database connection object pointer. |
upload_pk | Upload ID |
user_pk | User ID |
Definition at line 378 of file libfossagent.c.
char* getUploadTreeTableName | ( | fo_dbManager * | dbManager, |
int | uploadId | ||
) |
Get the upload tree table name for a given upload.
dbManager | The DB manager in use |
uploadId | ID of the upload |
Definition at line 25 of file libfossagent.c.
FUNCTION char* GetUploadtreeTableName | ( | PGconn * | pgConn, |
int | upload_pk | ||
) |
Get the uploadtree table name for this upload_pk If upload_pk does not exist, return "uploadtree".
pgConn | Database connection object pointer. |
upload_pk | Upload ID |
Definition at line 414 of file libfossagent.c.
FUNCTION int max | ( | int | permGroup, |
int | permPublic | ||
) |
Get the maximum group privilege.
permGroup | Permission level of the group |
permPublic | Public permission on the upload |
Definition at line 295 of file libfossagent.c.
FUNCTION int min | ( | int | user_perm, |
int | permExternal | ||
) |
Get the minimum permission level required.
user_perm | User level permission on the upload |
permExternal | External permission level on the upload |
Definition at line 306 of file libfossagent.c.
PGresult* queryFileIdsForUpload | ( | fo_dbManager * | dbManager, |
int | uploadId, | ||
bool | ignoreFilesWithMimeType | ||
) |
Get all file IDs (pfile_fk) for a given upload.
dbManager | fo_dbManager in use |
uploadId | ID of the upload |
ignoreFilesWithMimeType | To ignore Files With MimeType |
Definition at line 61 of file libfossagent.c.
char* queryPFileForFileId | ( | fo_dbManager * | dbManager, |
long | fileId | ||
) |
Get the pfile name for a given file ID.
dbManager | fo_dbManager in use |
fileId | File ID (pfile_pk) |
SHA1.MD5.SIZE
) Definition at line 122 of file libfossagent.c.