Example #1
0
func (redis *Redis) Init(test_mode bool, results publisher.Client) error {
	redis.InitDefaults()
	if !test_mode {
		redis.setFromConfig(config.ConfigSingleton.Protocols.Redis)
	}

	redis.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	redis.transactions.StartJanitor(protos.DefaultTransactionExpiration)
	redis.results = results

	return nil
}
Example #2
0
func (mongodb *Mongodb) Init(test_mode bool, results publisher.Client) error {
	debugf("Init a MongoDB protocol parser")

	mongodb.InitDefaults()
	if !test_mode {
		err := mongodb.setFromConfig(config.ConfigSingleton.Protocols.Mongodb)
		if err != nil {
			return err
		}
	}

	mongodb.requests = common.NewCache(
		mongodb.transactionTimeout,
		protos.DefaultTransactionHashSize)
	mongodb.requests.StartJanitor(mongodb.transactionTimeout)
	mongodb.responses = common.NewCache(
		mongodb.transactionTimeout,
		protos.DefaultTransactionHashSize)
	mongodb.responses.StartJanitor(mongodb.transactionTimeout)
	mongodb.results = results

	return nil
}
Example #3
0
func (dns *Dns) Init(test_mode bool, results chan common.MapStr) error {
	dns.initDefaults()
	if !test_mode {
		dns.setFromConfig(config.ConfigSingleton.Protocols.Dns)
	}

	dns.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	dns.transactions.StartJanitor(protos.DefaultTransactionExpiration)

	dns.results = results

	return nil
}
Example #4
0
// Creates and returns a new Tcp.
func NewTcp(p protos.Protocols) (*Tcp, error) {
	portMap, err := buildPortsMap(p.GetAllTcp())
	if err != nil {
		return nil, err
	}

	tcp := &Tcp{
		protocols: p,
		portMap:   portMap,
		streams: common.NewCache(protos.DefaultTransactionExpiration,
			protos.DefaultTransactionHashSize),
	}
	tcp.streams.StartJanitor(protos.DefaultTransactionExpiration)
	logp.Debug("tcp", "Port map: %v", portMap)

	return tcp, nil
}
Example #5
0
func (http *Http) Init(test_mode bool, results publisher.Client) error {
	http.InitDefaults()

	if !test_mode {
		err := http.SetFromConfig(config.ConfigSingleton.Protocols.Http)
		if err != nil {
			return err
		}
	}

	http.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	http.transactions.StartJanitor(protos.DefaultTransactionExpiration)
	http.results = results

	return nil
}
Example #6
0
func (mongodb *Mongodb) Init(test_mode bool, results chan common.MapStr) error {
	logp.Debug("mongodb", "Init a MongoDB protocol parser")

	mongodb.InitDefaults()
	if !test_mode {
		err := mongodb.setFromConfig(config.ConfigSingleton.Protocols.Mongodb)
		if err != nil {
			return err
		}
	}

	mongodb.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	mongodb.transactions.StartJanitor(protos.DefaultTransactionExpiration)
	mongodb.results = results

	return nil
}
Example #7
0
func (mysql *Mysql) Init(test_mode bool, results chan common.MapStr) error {

	mysql.InitDefaults()
	if !test_mode {
		err := mysql.setFromConfig(config.ConfigSingleton.Protocols.Mysql)
		if err != nil {
			return err
		}
	}

	mysql.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	mysql.transactions.StartJanitor(protos.DefaultTransactionExpiration)
	mysql.handleMysql = handleMysql
	mysql.results = results

	return nil
}
Example #8
0
// Init initializes the HTTP protocol analyser.
func (http *HTTP) Init(testMode bool, results publisher.Client) error {
	http.initDefaults()

	if !testMode {
		err := http.setFromConfig(config.ConfigSingleton.Protocols.Http)
		if err != nil {
			return err
		}
	}

	http.transactions = common.NewCache(
		http.transactionTimeout,
		protos.DefaultTransactionHashSize)
	http.transactions.StartJanitor(http.transactionTimeout)
	http.results = results

	return nil
}
Example #9
0
func (mysql *Mysql) Init(test_mode bool, results publisher.Client) error {

	mysql.InitDefaults()
	if !test_mode {
		err := mysql.setFromConfig(config.ConfigSingleton.Protocols.Mysql)
		if err != nil {
			return err
		}
	}

	mysql.transactions = common.NewCache(
		mysql.transactionTimeout,
		protos.DefaultTransactionHashSize)
	mysql.transactions.StartJanitor(mysql.transactionTimeout)
	mysql.handleMysql = handleMysql
	mysql.results = results

	return nil
}
Example #10
0
func (thrift *Thrift) Init(test_mode bool, results publisher.Client) error {

	thrift.InitDefaults()

	if !test_mode {
		err := thrift.readConfig(config.ConfigSingleton.Protocols.Thrift)
		if err != nil {
			return err
		}
	}

	thrift.transactions = common.NewCache(protos.DefaultTransactionExpiration,
		protos.DefaultTransactionHashSize)
	thrift.transactions.StartJanitor(protos.DefaultTransactionExpiration)

	if !test_mode {
		thrift.PublishQueue = make(chan *ThriftTransaction, 1000)
		thrift.results = results
		go thrift.publishTransactions()
	}

	return nil
}