# File Classification API.

## Files

file | rpmfc.h

| Structures and methods for build-time file classification.

## Typedefs

typedef struct rpmfc_s * | rpmfc
typedef enum FCOLOR_e | FCOLOR_t
typedef struct rpmfcTokens_s * | rpmfcToken

## Enumerations

enum | FCOLOR_e { RPMFC_BLACK = 0, RPMFC_ELF32 = (1 << 0), RPMFC_ELF64 = (1 << 1), RPMFC_ELFMIPSN32 = (1 << 2) }

## Functions

int | rpmfcExec (ARGV_const_t av, StringBuf sb_stdin, StringBuf *sb_stdoutp, int failnonzero)
| Return helper output.
int | rpmfcColoring (const char *fmstr)
| Return file color given file(1) string.
void | rpmfcPrint (const char *msg, rpmfc fc, FILE *fp)
| Print results of file classification.
rpmfc | rpmfcFree (rpmfc fc)
| Destroy a file classifier.
rpmfc | rpmfcNew (void)
| Create a file classifier.
rpmRC | rpmfcClassify (rpmfc fc, ARGV_t argv, rpm_mode_t *fmode)
| Build file class dictionary and mappings.
rpmRC | rpmfcApply (rpmfc fc)
| Build file/package dependency dictionary and mappings.
rpmRC | rpmfcGenerateDepends (const rpmSpec spec, Package pkg)
| Generate package dependencies.
rpmds | rpmfcProvides (rpmfc fc)
| Retrieve file classification provides.
rpmds | rpmfcRequires (rpmfc fc)
| Retrieve file classification requires.

## Typedef Documentation

typedef enum FCOLOR_e FCOLOR_t

Definition at line 75 of file rpmfc.h.

typedef struct rpmfc_s* rpmfc

Definition at line 22 of file rpmfc.h.

typedef struct rpmfcTokens_s* rpmfcToken

Definition at line 79 of file rpmfc.h.

## Enumeration Type Documentation

enum FCOLOR_e

Enumerator:

  RPMFC_BLACK |
  RPMFC_ELF32 |
  RPMFC_ELF64 |
  RPMFC_ELFMIPSN32 |

Definition at line 26 of file rpmfc.h.

## Function Documentation

rpmRC rpmfcApply | ( | rpmfc | fc | ) |

Build file/package dependency dictionary and mappings.

Parameters:

  | fc | file classifier

Returns:
  RPMRC_OK on success

rpmRC rpmfcClassify | ( | rpmfc | fc,
|  | ARGV_t | argv,
|  | rpm_mode_t * | fmode |
| ) |  |  |

Build file class dictionary and mappings.

Parameters:

  | fc | file classifier
  | argv | files to classify
  | fmode | files mode_t array (or NULL)

Returns:
  RPMRC_OK on success

int rpmfcColoring | ( | const char * | fmstr | ) |

Return file color given file(1) string.

Parameters:

  | fmstr | file(1) string

Returns:
  file color

int rpmfcExec | ( | ARGV_const_t | av,
|  | StringBuf | sb_stdin,
|  | StringBuf * | sb_stdoutp,
|  | int | failnonzero |
| ) |  |  |

Return helper output.

Parameters:

  | av | helper argv (with possible macros)
  | sb_stdin | helper input

Return values:

  | *sb_stdoutp | helper output

Parameters:

  | failnonzero | IS non-zero helper exit status a failure?

rpmfc rpmfcFree | ( | rpmfc | fc | ) |

Destroy a file classifier.

Parameters:

  | fc | file classifier

Returns:
  NULL always

rpmRC rpmfcGenerateDepends | ( | const rpmSpec | spec,
|  | Package | pkg |
| ) |  |  |

Generate package dependencies.

Parameters:

  | spec | spec file control
  | pkg | package control

Returns:
  RPMRC_OK on success

rpmfc rpmfcNew | ( | void |  | ) |

Create a file classifier.

Returns:
  new file classifier

void rpmfcPrint | ( | const char * | msg,
|  | rpmfc | fc,
|  | FILE * | fp |
| ) |  |  |

Print results of file classification.

Todo:
  Remove debugging routine.

Parameters:

  | msg | message prefix (NULL for none)
  | fc | file classifier
  | fp | output file handle (NULL for stderr)

rpmds rpmfcProvides | ( | rpmfc | fc | ) |

Retrieve file classification provides.

Parameters:

  | fc | file classifier

Returns:
  rpmds dependency set of fc provides

rpmds rpmfcRequires | ( | rpmfc | fc | ) |

Retrieve file classification requires.

Parameters:

  | fc | file classifier

Returns:
  rpmds dependency set of fc requires