How OSPF establishes neighboor relation, what the stages are?

States in OSPF neighbor adjacency process:

-Down State

This is the first OSPF neighbor state. It indicates that no Hello has been received from the neighbor.

This state is only valid for manually configured neighbors in an NBMA environment.

This state indicates that the router has received a hello packet from its neighbor, but the receiving router’s ID was not found in the Hello packet

This state indicates that the bi-directional communication has been established between the 2 neighbors.

In this state, the router
The neighbor with the highest Router ID becomes the master.

In this state, OSPF router exchange DBD packets.
DBD packet contains the summary of the LSA headers.
DBDs are acknowledged and reviewed in this state.

Slave requests the details (LSR)
Master sends updates (LSU)
Master requests the details (LSR)
Slave sends updates (LSU)

In this state, routers are fully adjacent with each other and their database is synchronized.