The geometrical framework for Yang-Mills theories