FOSSology  4.5.1
Open Source License Compliance by Open Source Software
libfossagent.h
1 /*
2  SPDX-FileCopyrightText: © 2011 Hewlett-Packard Development Company, L.P.
3  SPDX-FileCopyrightText: © 2015 Siemens AG
4 
5  SPDX-License-Identifier: LGPL-2.1-only
6 */
7 
8 #ifndef LIBFOSSAGENT_H
9 #define LIBFOSSAGENT_H
10 
11 #include <stdlib.h>
12 #include <stdio.h>
13 #include <stdbool.h>
14 #include <libpq-fe.h>
15 
16 #include "libfossdbmanager.h"
17 
18 char* getUploadTreeTableName(fo_dbManager* dbManager, int uploadId);
19 PGresult* queryFileIdsForUpload(fo_dbManager* dbManager, int uploadId, bool ignoreFilesWithMimeType);
20 char* queryPFileForFileId(fo_dbManager* dbManager, long int fileId);
21 int fo_GetAgentKey(PGconn* pgConn, const char* agent_name, long unused, const char* cpunused, const char* agent_desc);
22 int fo_WriteARS(PGconn* pgConn, int ars_pk, int upload_pk, int agent_pk,
23  const char* tableName, const char* ars_status, int ars_success);
24 int fo_CreateARSTable(PGconn* pgConn, const char* table_name);
25 int getEffectivePermissionOnUpload(PGconn* pgConn, long UploadPk, int user_pk, int user_perm);
26 int GetUploadPerm(PGconn* pgConn, long UploadPk, int user_pk);
27 char* GetUploadtreeTableName(PGconn* pgConn, int upload_pk);
28 PGresult* checkDuplicateReq(PGconn* pgConn, int uploadPk, int agentPk);
29 PGresult* getSelectedPFiles(PGconn* pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType);
30 
31 #endif
PGconn * pgConn
Database connection.
Definition: adj2nest.c:86
int agent_pk
Definition: agent.h:74
char * queryPFileForFileId(fo_dbManager *dbManager, long fileId)
Get the pfile name for a given file ID.
Definition: libfossagent.c:122
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".
Definition: libfossagent.c:414
FUNCTION int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
Definition: libfossagent.c:378
char * getUploadTreeTableName(fo_dbManager *dbManager, int uploadId)
Get the upload tree table name for a given upload.
Definition: libfossagent.c:25
FUNCTION int fo_CreateARSTable(PGconn *pgConn, const char *tableName)
Create ars table if it doesn't already exist.
Definition: libfossagent.c:270
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.
Definition: libfossagent.c:442
PGresult * queryFileIdsForUpload(fo_dbManager *dbManager, int uploadId, bool ignoreFilesWithMimeType)
Get all file IDs (pfile_fk) for a given upload.
Definition: libfossagent.c:61
FUNCTION int getEffectivePermissionOnUpload(PGconn *pgConn, long UploadPk, int user_pk, int user_perm)
Get users permission to this upload.
Definition: libfossagent.c:321
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.
Definition: libfossagent.c:214
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.
Definition: libfossagent.c:158
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.
Definition: libfossagent.c:469
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:16
const char * upload_pk
Definition: sqlstatements.h:82