Libnids is a library that provides the function of one of the NIDS
(Network Intrusion Detection System) components, namely E-component. The
libnids code watches all local network traffic, processes received
datagrams a bit, and provides convenient information on them to analyzing
modules. Libnids performs:

a) assembly of TCP segments into TCP streams
b) IP defragmentation
c) TCP port scan detection 

WWW: http://www.packetfactory.net/projects/libnids/