Republic of Ireland manager Martin O'Neill has agreed a new contract to remain in charge of the team until the 2018 World Cup.