SU(N) gauge theories with C-periodic boundary conditions (I). Topological structure