FOSSology  4.4.0
Open Source License Compliance by Open Source Software
snippet_scan.c File Reference

Scanoss agent for Fossology. Scans for licenses on osskb.org. More...

#include "snippet_scan.h"
#include <stdio.h>
#include <errno.h>
Include dependency graph for snippet_scan.c:

Go to the source code of this file.

Functions

void logme (char *msg)
 
int splitLine (char *lineToSplit, char *separator, char **fields)
 
void extract_csv (char *out, char *in, int n, long limit, char sep)
 
FILE * openFileByKey (long pFileKey)
 Open a file of the repository given its primary key. More...
 
int getLicenseId (unsigned char *name)
 Retrieves the license id (license_ref.rf_pk) given its short name.
 
void dumpToFile (const char *path, unsigned char *content, long size)
 Dumps the content of a file in the repository to a temporary file. More...
 
void RestoreTempFile (char *uploadFolder, long key, long realParent, char *realName)
 
void ParseResults (char *folder)
 Parse results from a temporary file and store results on database. More...
 
int ScanFolder (char *folder)
 Scans a Temporary folder. More...
 
int RebuildUpload (long upload_pk, char *tempFolder)
 
void Usage (char *Name)
 Say how to run this program. More...
 

Variables

char * baseTMP
 
int Verbose = 0
 Verbose level. More...
 
PGconn * db_conn = NULL
 The connection to Database. More...
 
int Agent_pk
 agent identifier
 
char ApiUrl [200]
 
char accToken [100]
 

Detailed Description

Scanoss agent for Fossology. Scans for licenses on osskb.org.

snippet_scan.c

The SCANOSS Agent for Fossology tool

Copyright (C) 2018-2021 SCANOSS.COM

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.

Date

Definition in file snippet_scan.c.

Function Documentation

◆ dumpToFile()

void dumpToFile ( const char *  path,
unsigned char *  content,
long  size 
)

Dumps the content of a file in the repository to a temporary file.

Parameters
pathPath to the temporary file
contentBuffer containing the file
sizeSize of the file to be stored

Definition at line 129 of file snippet_scan.c.

◆ openFileByKey()

FILE* openFileByKey ( long  pFileKey)

Open a file of the repository given its primary key.

Parameters
pFileKeythe key of the file to be retrieved
Returns
Pointer to the file

Definition at line 82 of file snippet_scan.c.

◆ ParseResults()

void ParseResults ( char *  folder)

Parse results from a temporary file and store results on database.

Parameters
folderPath to the temporary project folder

If the key is valid, insert the result on DB Table

Unknown license

Definition at line 185 of file snippet_scan.c.

◆ ScanFolder()

int ScanFolder ( char *  folder)

Scans a Temporary folder.

Scans a Temporary folder with a rebuild project and place it results on a file results.csv

Parameters
folderpath to temp folder

Definition at line 269 of file snippet_scan.c.

◆ Usage()

void Usage ( char *  Name)

Say how to run this program.

Print usage of bucket agent

Parameters
NameAbsolute path of agent

Many agents permit running from the command-line for testing. At minimum, you need "-i" to initialize the DB and exit.

Say how to run this program.

Parameters
Name- the name of the executable, usually it is mimetype

Say how to run this program.

Parameters
NamePath to nomos binary

Usage():

Say how to run this program.

Usage():

Say how to run this program.

Usage():

Parameters
NamePath of the binary

Definition at line 395 of file snippet_scan.c.

Variable Documentation

◆ db_conn

PGconn* db_conn = NULL

The connection to Database.

the connection to Database

Definition at line 35 of file snippet_scan.c.

◆ Verbose

int Verbose = 0

Verbose level.

Global verbose level.

Contains all the functions supported by delagent

Verbosity level

Definition at line 34 of file snippet_scan.c.