FOSSology  4.4.0
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 
9 /**************************************************************
10 Copyright (C) 2011 Hewlett-Packard Development Company, L.P.
11 Copyright (C) 2015 Siemens AG
12 
13 This library is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License version 2.1 as published by the Free Software Foundation.
16 
17 This library is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21 
22 You should have received a copy of the GNU Lesser General Public License
23 along with this library; if not, write to the Free Software Foundation, Inc.0
24 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
25 **************************************************************/
26 #ifndef LIBFOSSAGENT_H
27 #define LIBFOSSAGENT_H
28 
29 #include <stdlib.h>
30 #include <stdio.h>
31 #include <stdbool.h>
32 #include <libpq-fe.h>
33 
34 #include "libfossdbmanager.h"
35 
36 char* getUploadTreeTableName(fo_dbManager* dbManager, int uploadId);
37 PGresult* queryFileIdsForUpload(fo_dbManager* dbManager, int uploadId, bool ignoreFilesWithMimeType);
38 char* queryPFileForFileId(fo_dbManager* dbManager, long int fileId);
39 int fo_GetAgentKey(PGconn* pgConn, const char* agent_name, long unused, const char* cpunused, const char* agent_desc);
40 int fo_WriteARS(PGconn* pgConn, int ars_pk, int upload_pk, int agent_pk,
41  const char* tableName, const char* ars_status, int ars_success);
42 int fo_CreateARSTable(PGconn* pgConn, const char* table_name);
43 int getEffectivePermissionOnUpload(PGconn* pgConn, long UploadPk, int user_pk, int user_perm);
44 int GetUploadPerm(PGconn* pgConn, long UploadPk, int user_pk);
45 char* GetUploadtreeTableName(PGconn* pgConn, int upload_pk);
46 PGresult* checkDuplicateReq(PGconn* pgConn, int uploadPk, int agentPk);
47 PGresult* getSelectedPFiles(PGconn* pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType);
48 
49 #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