Electromagnetic scattering from dielectric and magnetic gratings of fibers - a T-matrix solution