  We show that dark matter haloes, in n--body simulations, have a boundary
layer (BL) with precise features. In particular, it encloses all dynamically
stable mass while, outside it, dynamical stability is lost soon. Particles can
pass through such BL, which however acts as a confinement barrier for dynamical
properties. BL is set by evaluating kinetic and potential energies (T(r) and
W(r)) and calculating R=-2T/W. Then, on BL, R has a minimum which closely
approaches a maximum of w= -dlog W/dlog r. Such $Rw$ ``requirement'' is
consistent with virial equilibrium, but implies further regularities. We test
the presence of a BL around haloes in spatially flat CDM simulations, with or
without cosmological constant. We find that the mass M_c, enclosed within the
radius r_c, where the $Rw$ requirement is fulfilled, closely approaches the
mass M_{dyn}, evaluated from the velocities of all particles within r_c,
according to the virial theorem. Using r_c we can then determine an individual
density contrast Delta_c for each virialized halo, which can be compared with
the "virial" density contrast $\Delta_v ~178 \Omega_m^{0.45}$ (Omega_m: matter
density parameter) obtained assuming a spherically symmetric and unperturbed
fluctuation growth. The spread in Delta_c is wide, and cannot be neglected when
global physical quantities related to the clusters are calculated, while the
average Delta_c is ~25 % smaller than the corresponding Delta_v; moreover if
$M_{dyn}$ is defined from the radius linked to Delta_v, we have a much worse
fit with particle mass then starting from {\it Rw} requirement.
