FOSSology  4.4.0
Open Source License Compliance by Open Source Software
standalone.c
1 /*
2  SPDX-FileCopyrightText: © 2020 Siemens AG
3 
4  SPDX-License-Identifier: GPL-2.0-only
5 */
6 
7 /*
8 **
9  * \file
10  * this is provide a dummy values for library function to make ununpack agent standalone
11  */
12 #include "standalone.h"
13 #include <sys/stat.h>
14 #include <stdio.h>
15 #include <glib.h>
16 #include <errno.h>
17 
18 int result = 0;
19 
20 void fo_scheduler_heart(int i){}
21 void fo_scheduler_connect(int* argc, char** argv, PGconn** db_conn){}
22 void fo_scheduler_disconnect(int retcode){}
23 char* fo_scheduler_next(){return(0);}
24 int fo_scheduler_userID(){return(0);}
25 void fo_scheduler_set_special(int option, int value){}
26 int fo_scheduler_get_special(int option){return(0);}
27 char* fo_sysconfig(const char* sectionname, const char* variablename){return(0);}
28 int fo_GetAgentKey (PGconn *pgConn, const char *agent_name, long unused, const char *cpunused, const char *agent_desc){return(0);}
29 int fo_WriteARS(PGconn *pgConn, int ars_pk, int upload_pk, int agent_pk,
30  const char *tableName, const char *ars_status, int ars_success){return(0);}
31 int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb){return(0);}
32 int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb){return(0);}
33 int fo_tableExists(PGconn *pgConn, const char *tableName){return(0);}
34 int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk){return(10);}
35 int fo_CreateARSTable(PGconn* pgConn, const char* tableName){return(0);}
36 
37 int PQresultStatus(const PGresult *res){ return(PGRES_COMMAND_OK);}
38 char* PQresultErrorMessage(const PGresult *res){return(0);}
39 char* PQresultErrorField(const PGresult *res, int fieldcode){return(0);}
40 int PQntuples(const PGresult *res){return(1);}
41 PGresult *PQexec(PGconn *conn, const char *query){return(0);}
42 void PQclear(PGresult *res){}
43 char* PQgetvalue(const PGresult *res, int tup_num, int field_num){return("1");}
44 size_t PQescapeStringConn(PGconn *conn,
45  char *to, const char *from, size_t length, int *error){*error=0;return(0);}
46 void PQfinish(PGconn *conn){}
47 
48 void PQsetNoticeProcessor(PGconn *pgConn, char *SQLNoticeProcessor, char *SQL){}
49 
50 char* fo_RepMkPath (char *Type, char *Filename){return(0);}
51 int fo_RepExist(char* Type, char* Filename){return 1;}
52 int fo_RepExist2(char* Type, char* Filename){return 0;}
53 int fo_RepImport(char* Source, char* Type, char* Filename, int HardLink){return 0;}
char SQL[256]
SQL query to execute.
Definition: adj2nest.c:78
PGconn * pgConn
Database connection.
Definition: adj2nest.c:86
int agent_pk
Definition: agent.h:74
FUNCTION int fo_CreateARSTable(PGconn *pgConn, const char *tableName)
Create ars table if it doesn't already exist.
Definition: libfossagent.c:270
char * fo_RepMkPath(const char *Type, char *Filename)
Given a filename, construct the full path to the file.
Definition: libfossrepo.c:352
int fo_RepExist2(char *Type, char *Filename)
Determine if a file exists.
Definition: libfossrepo.c:531
int fo_RepImport(char *Source, char *Type, char *Filename, int Link)
Import a file into the repository.
Definition: libfossrepo.c:812
int fo_RepExist(char *Type, char *Filename)
Determine if a file exists.
Definition: libfossrepo.c:486
void fo_scheduler_disconnect(int retcode)
Disconnect the scheduler connection.
Definition: standalone.c:16
void fo_scheduler_heart(int i)
This function must be called by agents to let the scheduler know they are alive and how many items th...
Definition: standalone.c:14
void fo_scheduler_set_special(int option, int value)
Sets something special about the agent within the scheduler.
Definition: standalone.c:20
char * fo_sysconfig(const char *sectionname, const char *variablename)
gets a system configuration variable from the configuration data.
Definition: standalone.c:22
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: standalone.c:24
int fo_checkPQresult(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres SELECT.
Definition: standalone.c:28
int fo_scheduler_get_special(int option)
Gets if a particular special attribute is set in the scheduler.
Definition: standalone.c:21
int fo_GetAgentKey(PGconn *pgConn, const char *agent_name, long unused, const char *cpunused, const char *agent_desc)
Get the latest enabled agent key (agent_pk) from the database.
Definition: standalone.c:23
int fo_scheduler_userID()
Gets the id of the user that created the job that the agent is running.
Definition: standalone.c:19
int fo_tableExists(PGconn *pgConn, const char *tableName)
Check if table exists. Note, this assumes the database name is 'fossology'.
Definition: standalone.c:29
char * fo_scheduler_next()
Get the next data to process from the scheduler.
Definition: standalone.c:17
int fo_checkPQcommand(PGconn *pgConn, PGresult *result, char *sql, char *FileID, int LineNumb)
Check the result status of a postgres commands (not select) If an error occured, write the error to s...
Definition: standalone.c:27
void fo_scheduler_connect(int *argc, char **argv, PGconn **db_conn)
Establish a connection between an agent and the scheduler.
Definition: standalone.c:15
int GetUploadPerm(PGconn *pgConn, long UploadPk, int user_pk)
Get users permission to this upload.
Definition: standalone.c:31
PGconn * db_conn
The connection to Database.
Definition: pkgagent.c:22
const char * upload_pk
Definition: sqlstatements.h:82
void SQLNoticeProcessor(void *arg, const char *message)
Dummy postgresql notice processor. This prevents Notices from being written to stderr.
Definition: utils.c:1772
char * Filename
Filename.
Definition: run_tests.c:17