The purpose of having stubs in OSPF is to filter the LSAs flooding the area.

Backbone area and non-stub area:

Accepts Type 1,2,3,4,5 but drops Type 7

Stub area:

Accepts Type 1,2,3 but drops 4,5 and 7

Totally Stub area:

Accepts Type 1,2 but drops 3*,4,5 and 7.

*Exception: Type 3 with a single default route is accepted.

Not-so-stubby-area (NSSA)

Accepts Type 1,2,3,4 and 7 but drops 5.

Type 7 LSA only floods in NSSA, router receives Hello packets from neighbour router and observe the option, the N bit if set to 1 is a NSSA capable router if set to 0 is NSSA incapable. N bit must match to form adjacency. P bit if set will make the ABR in NSSA translate type 7 to type 5 and propagate type 5 LSA to other areas. If P bit is not set then ABR of NSSA will drop type 7 LSA and the advertisement only contain within NSSA. N/P bit coexists.