FOSSology  3.2.0rc1
Open Source License Compliance by Open Source Software
libfossagent.h
1 /**************************************************************
2 Copyright (C) 20011 Hewlett-Packard Development Company, L.P.
3 Copyright (C) 2015 Siemens AG
4 
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License version 2.1 as published by the Free Software Foundation.
8 
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Lesser General Public License for more details.
13 
14 You should have received a copy of the GNU Lesser General Public License
15 along with this library; if not, write to the Free Software Foundation, Inc.0
16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17 **************************************************************/
18 #ifndef LIBFOSSAGENT_H
19 #define LIBFOSSAGENT_H
20 
21 #include <stdlib.h>
22 #include <stdio.h>
23 #include <stdbool.h>
24 #include <libpq-fe.h>
25 
26 #include "libfossdbmanager.h"
27 
28 char* getUploadTreeTableName(fo_dbManager* dbManager, int uploadId);
29 PGresult* queryFileIdsForUpload(fo_dbManager* dbManager, int uploadId, bool ignoreFilesWithMimeType);
30 char* queryPFileForFileId(fo_dbManager* dbManager, long int fileId);
31 int fo_GetAgentKey(PGconn* pgConn, const char* agent_name, long unused, const char* cpunused, const char* agent_desc);
32 int fo_WriteARS(PGconn* pgConn, int ars_pk, int upload_pk, int agent_pk,
33  const char* tableName, const char* ars_status, int ars_success);
34 int fo_CreateARSTable(PGconn* pgConn, const char* table_name);
35 int getEffectivePermissionOnUpload(PGconn* pgConn, long UploadPk, int user_pk, int user_perm);
36 int GetUploadPerm(PGconn* pgConn, long UploadPk, int user_pk);
37 char* GetUploadtreeTableName(PGconn* pgConn, int upload_pk);
38 PGresult* checkDuplicateReq(PGconn* pgConn, int uploadPk, int agentPk);
39 PGresult* getSelectedPFiles(PGconn* pgConn, int uploadPk, int agentPk, bool ignoreFilesWithMimeType);
40 
41 #endif
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:421
char * queryPFileForFileId(fo_dbManager *dbManager, long fileId)
Get the pfile name for a given file ID.
Definition: libfossagent.c:136
PGconn * pgConn
Database connection.
Definition: adj2nest.c:98
char * getUploadTreeTableName(fo_dbManager *dbManager, int uploadId)
Get the upload tree table name for a given upload.
Definition: libfossagent.c:37
FUNCTION int getEffectivePermissionOnUpload(PGconn *pgConn, long UploadPk, int user_pk, int user_perm)
Get users permission to this upload.
Definition: libfossagent.c:335
FUNCTION int fo_CreateARSTable(PGconn *pgConn, const char *tableName)
Create ars table if it doesn&#39;t already exist.
Definition: libfossagent.c:284
fo_dbManager * dbManager
fo_dbManager object
Definition: process.c:28
int agent_pk
Definition: agent.h:85
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:172
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:228
FUNCTION int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
Definition: libfossagent.c:385
PGresult * queryFileIdsForUpload(fo_dbManager *dbManager, int uploadId, bool ignoreFilesWithMimeType)
Get all file IDs (pfile_fk) for a given upload.
Definition: libfossagent.c:73
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:476
const char * upload_pk
Definition: sqlstatements.h:93
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:449