// NewReaderStream returns a new ReaderStreamWrapper object.
func NewReaderStreamWrapper() ReaderStreamWrapper {
	r := ReaderStreamWrapper{
		ReaderStream: tcpreader.NewReaderStream(),
		Reassemblies: make([]ReassemblyInfo, 0),
	}
	//	r.ReaderStream.ReaderStreamOptions.LossErrors = true
	return r
}
Exemple #2
0
func (h *DNSStreamFactory) New(net, transport gopacket.Flow) tcpassembly.Stream {
	hstream := &dnsStream{
		net:       net,
		transport: transport,
		r:         tcpreader.NewReaderStream(),
	}
	go hstream.run(h.normal) // Important... we must guarantee that data from the reader stream is read.
	// ReaderStream implements tcpassembly.Stream, so we can return a pointer to it.
	return &hstream.r
}
func NewHttpResponseStream(httpRequest *HttpRequestStream, wg *sync.WaitGroup) *HttpResponseStream {
	//
	stream := HttpResponseStream{}
	stream.reader = tcpreader.NewReaderStream()
	stream.wg = wg
	stream.httpRequest = httpRequest

	//
	go stream.start()

	//
	return &stream
}
func NewHttpRequestStream(wg *sync.WaitGroup) *HttpRequestStream {
	//
	stream := HttpRequestStream{}
	stream.reader = tcpreader.NewReaderStream()
	stream.wg = wg

	//
	logHRSCount++
	stream.wg.Add(1)

	//
	go stream.start()
	return &stream
}
Exemple #5
0
func (w *rtmpStreamWrapper) New(net, tcp gopacket.Flow) tcpassembly.Stream {
	// TODO all glog messages in the rtmpStream should include this prefix:
	//	prefix := fmt.Sprintf("%s ", tcp)  FIXME
	s := &rtmpStream{
		track:     make(map[uint32]*RTMPMessage),
		finalizer: &MessageFinalizer{r: w.output},
		chunkSize: 128,
	}

	w.outer.Add(1)
	r := tcpreader.NewReaderStream()
	go s.parseStream(w.outer, &r)
	return &r
}