Main Page | Data Structures | File List | Data Fields | Globals | Related Pages

transforms.c File Reference

#include "common.h"
#include <stdlib.h>
#include <string.h>
#include "enums.h"
#include "transforms.h"
#include "integ.h"
#include "encr.h"
#include "prf.h"

Functions

ProposalCloneProposal (struct Proposal *prop, struct Proposal *ref)
 Clone proposal prop with first transform of each type, which is also in ref.
ProposalAddProposal (struct Proposal **list)
 Add a new proposal to proposal list.
void RemoveProposal (struct Proposal *prop, struct Proposal **list)
 Removes a proposal from propsals list.
void DeleteProposal (struct Proposal *prop)
 Free proposal with protocols and transforms.
void DeleteProposalList (struct Proposal *prop)
 Free a list of proposals.
ProtocolAddProtocol (struct Proposal *prop, uint8_t protocol, uint8_t SPISize, uint32_t SPI)
 Add a protocol to a given proposal.
void RemoveProtocol (struct Protocol *protocol, struct Proposal *prop)
 Removes a protocol from proposals list.
void DeleteProtocol (struct Protocol *protocol)
 Free a protocol with transforms.
int AddTransform (struct Protocol *protocol, uint8_t type, uint16_t id, uint16_t keyLen)
 Add a transform to a protocol.
void RemoveTransform (struct Transform *trans, struct Protocol *protocol)
 Remova transform.
uint16_t GetTransformID (uint8_t type, uint8_t protocol, struct Protocol *list)
 Get a transform id for a given transform typa and protocol.
uint16_t GetTransformKeyLen (uint8_t type, uint8_t protocol, struct Protocol *list)
 Get a transform key length for a given transform type and protocol.
int CheckNeededTransforms (struct Proposal *prop)
 Check for required transform types.
ProposalFindFirstSupportedProposal (struct Proposal *prop, struct Proposal *list)
 Find a supported proposal, if there is any.
int CmpProposal (struct Proposal *p1, struct Proposal *p2)
 Compare two proposals.
ProposalFindProposal (struct Proposal *prop, struct Proposal *list)
 Find proposal in proposal list.

Function Documentation

struct Proposal* AddProposal struct Proposal **  list  ) 
 

Add a new proposal to proposal list.

Parameters:
**list proposal list
Returns:
ptr to added proposal or NULL when fail

struct Protocol* AddProtocol struct Proposal prop,
uint8_t  protocol,
uint8_t  SPISize,
uint32_t  SPI
 

Add a protocol to a given proposal.

Parameters:
*prop target proposal
protocol protocol ID
SPISize SPI size
SPI SPI
Returns:
ptr to new added protocol or NULL when fail

int AddTransform struct Protocol protocol,
uint8_t  type,
uint16_t  id,
uint16_t  keyLen
 

Add a transform to a protocol.

Parameters:
*protocol protocol struct
type transform type
id transform id
keyLen key length if required, 0 otherwise
Returns:
1 on success, 0 otherwise

int CheckNeededTransforms struct Proposal prop  ) 
 

Check for required transform types.

Parameters:
*prop proposals
Returns:
1 on success, 0 otherwise

struct Proposal* CloneProposal struct Proposal prop,
struct Proposal ref
 

Clone proposal prop with first transform of each type, which is also in ref.

Parameters:
*prop source
*ref reference
Returns:
result proposal

int CmpProposal struct Proposal p1,
struct Proposal p2
 

Compare two proposals.

Parameters:
*p1 argument 1
*p2 argument 2
Returns:
1 if equal, 0 otherwise

void DeleteProposal struct Proposal prop  ) 
 

Free proposal with protocols and transforms.

Parameters:
*prop proposal to free

void DeleteProposalList struct Proposal prop  ) 
 

Free a list of proposals.

Parameters:
*prop ptrr to proposals list

void DeleteProtocol struct Protocol protocol  ) 
 

Free a protocol with transforms.

Parameters:
*protocol protocol to free

struct Proposal* FindFirstSupportedProposal struct Proposal prop,
struct Proposal list
 

Find a supported proposal, if there is any.

Parameters:
*prop proposal to find
*list proposal list
Returns:
copy of founded proposal, or NULL if not found

struct Proposal* FindProposal struct Proposal prop,
struct Proposal list
 

Find proposal in proposal list.

Parameters:
*prop proposal to find
*list proposal list
Returns:
ptr to founded proposal

uint16_t GetTransformID uint8_t  type,
uint8_t  protocol,
struct Protocol list
 

Get a transform id for a given transform typa and protocol.

Parameters:
type transform type
protocol protocol ID
*list protocol list
Returns:
transform ID, or 0 when not found

uint16_t GetTransformKeyLen uint8_t  type,
uint8_t  protocol,
struct Protocol list
 

Get a transform key length for a given transform type and protocol.

Parameters:
type transform type
protocol protocol ID
*list protocol list
Returns:
key length

void RemoveProposal struct Proposal prop,
struct Proposal **  list
 

Removes a proposal from propsals list.

Parameters:
*prop proposal to remove
**list proposal list

void RemoveProtocol struct Protocol protocol,
struct Proposal prop
 

Removes a protocol from proposals list.

Parameters:
*protocol protocol to remove
*prop proposals list

void RemoveTransform struct Transform trans,
struct Protocol protocol
 

Remova transform.

Parameters:
*trans transform to remove
*protocol protocol with given transform


Project hosted by: SourceForge.net Logo