예제 #1
0
void FORTE_GET_AT_INDEX::executeEvent(int pa_nEIID){
	switch(pa_nEIID){
	case scm_nEventREQID:

		if(CIEC_ANY::e_ARRAY == IN_ARRAY().getDataTypeID()){
			CIEC_ARRAY &rInArray = static_cast<CIEC_ARRAY&>(IN_ARRAY());
			//check if data types match
			if(rInArray.getElementDataTypeID() == OUT().getDataTypeID()){
				//now check array length of input array
				if(INDEX() < rInArray.size()){
					//update the output value
					OUT().setValue(*rInArray[INDEX()]);
					QO() = true;
				}
				else{
					DEVLOG_DEBUG("Access index out of range.\n");
					QO() = false;
				}
			}
			else{
				DEVLOG_DEBUG("Inequal element data types.\n");
				QO() = false;
			}
		}
		else{
			DEVLOG_DEBUG("No 'Array' typed input and output data.\n");
			QO() = false;
		}
		sendOutputEvent(scm_nEventCNFID);

		break;
	}
}
예제 #2
0
/*! remove a key from the map
  \param[in] m the map
  \param[in] key the key to remove
  \param[in] tag the tag to remove
  \param[in] time the current time
  \returns
  2:key not found or expired
  1:success
*/
int flowmap_remove(flowmap *m, uint64_t key, uint8_t tag, uint32_t time) {
  assert(m);

  uint64_t hash, hashtag;
  flowmap_node *n;
  flowmap_entry *entry;
  flowmap_overflow_node *o;
  bool is_overflow;
  uint32_t *prev;
  int rv;

  hash = m->hash(key, m->seed);
  n = &m->array[hash & m->array_mask];
  hashtag = (hash & FLOWMAP_HASH_MASK) + (tag << FLOWMAP_TAG_SHIFT);
  entry = NULL;
  prev = NULL;

  // acquire lock before accessing the chain
  msb_spinlock32_lock(&n->next);

  switch (_flowmap_search(m, hashtag, n, time, false, &entry, &is_overflow,
                          &prev)) {
    case 1:
      rv = 1;
      if (IN_ARRAY(entry, m->array, m->array_mask + 1)) {
        entry->entry = 0;
        entry->expiration = 0;
      } else {  // overflow entry
        o = CONTAINER_OF(entry, struct flowmap_overflow_node, entry);
        if (prev == NULL) {
          msb_spinlock32_setval(&n->next, o->next);
        } else {
          *prev = o->next;
        }
        _flowmap_overflow_free(m, o);
      }
      break;
    case -3:  // not found
      rv = 2;
      break;
    default:  // shouldn't get here
      rv = 2;
      assert(0);
  }

  // release the locks
  if (is_overflow)
    _flowmap_overflow_unlock(m);
  msb_spinlock32_unlock(&n->next);

  return rv;
}
예제 #3
0
	IATTRIBUTE_USERINFO: ASN.1-encoded user information containing their 
		role, ID, name information, and any additional required information.

   The lookup process for a given user's information is to read the 
   IATTRIBUTE_USERINDEX from the user index keyset (typically index.p15) to 
   find the user's index value, and then use that to read the 
   IATTRIBUTE_USERINFO from the user keyset (typically u<index>.p15).  The 
   cryptlib-wide IATTRIBUTE_CONFIGDATA is stored in the cryptlib default 
   initialisation keyset, typically cryptlib.p15.

   If we're being sent empty data (corresponding to an empty SEQUENCE, so 
   dataLength < 8), it means that the caller wants to clear this entry */

CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 4 ) ) \
int addConfigData( IN_ARRAY( noPkcs15objects ) PKCS15_INFO *pkcs15info, 
				   IN_LENGTH_SHORT const int noPkcs15objects, 
				   IN_ATTRIBUTE const CRYPT_ATTRIBUTE_TYPE dataType,
				   IN_BUFFER( dataLength ) const char *data, 
				   IN_LENGTH_SHORT const int dataLength )
	{
	PKCS15_INFO *pkcs15infoPtr = NULL;
	const BOOLEAN isDataClear = ( dataLength < 8 ) ? TRUE : FALSE;
	void *newData;
	int i;

	assert( isWritePtr( pkcs15info, \
						sizeof( PKCS15_INFO ) * noPkcs15objects ) );
	assert( isReadPtr( data, dataLength ) );

	REQUIRES( noPkcs15objects >= 1 && \
예제 #4
0
/****************************************************************************
*																			*
*								Read a Keyring								*
*																			*
****************************************************************************/

/* Read an entire keyring.  This function can be used in one of two ways, if 
   key match information is supplied each packet will be checked against it 
   and the read will exit when a match is found (used for public keyrings).  
   If no key match information is supplied, all keys will be read into 
   memory (used for private keyrings) */

CHECK_RETVAL STDC_NONNULL_ARG( ( 1, 2, 4, 8, 9 ) ) \
static int processKeyringPackets( INOUT STREAM *stream, 
								  IN_ARRAY( maxNoPgpObjects ) PGP_INFO *pgpInfo, 
								  IN_LENGTH_SHORT const int maxNoPgpObjects,
								  OUT_BUFFER_FIXED( bufSize ) BYTE *buffer, 
								  IN_LENGTH_SHORT_MIN( 64 ) const int bufSize,
								  IN_OPT const KEY_MATCH_INFO *keyMatchInfo,
								  INOUT_OPT PGP_KEYINFO **matchedKeyInfoPtrPtr,
								  OUT BOOLEAN *unhandledDataPresent,
								  INOUT ERROR_INFO *errorInfo )
	{
	BYTE streamBuffer[ STREAM_BUFSIZE + 8 ];
	BOOLEAN moreData, insecureKeys = FALSE;
	int bufEnd, keyGroupNo = 0, iterationCount, status;

	assert( isWritePtr( stream, sizeof( STREAM ) ) );
	assert( isWritePtr( pgpInfo, sizeof( PGP_INFO ) * maxNoPgpObjects ) );
	assert( isWritePtr( buffer, bufSize ) );
예제 #5
0
bool Target::isAssigned(const Food& food) const
{
    return IN_ARRAY(food,food_targets);
}