In a fusion tokamak, the plasma of hydrogen isotopes is in contact with tungsten at the surface of a divertor. In the bulk of the material, the hydrogen concentration profile tends towards dynamic equilibrium between the flux of incident ions and their trapping and release from defects, either native or produced by ion and neutron irradiation. The dynamics of hydrogen exchange between the plasma and the material is controlled by pressure, temperature, and also by the energy barriers characterizing hydrogen diffusion in the material, trapping and de-trapping from defects. In this work, we extend the treatment of interaction of hydrogen with vacancy-type defects, and investigate how hydrogen is trapped by self-interstitial atom defects and dislocations. The accumulation of hydrogen on dislocation loops and dislocations is assessed using a combination of density functional theory (DFT), molecular dynamics with empirical potentials, and linear elasticity theory. The equilibrium configurations adopted by hydrogen atoms in the core of dislocations as well as in the elastic fields of defects, are modelled by DFT. The structure of the resulting configurations can be rationalised assuming that hydrogen atoms interact elastically with lattice distortions and that they interact between themselves through short-range repulsion. We formulate a two-shell model for hydrogen interaction with an interstitial defect of any size, which predicts how hydrogen accumulates at defects, dislocation loops and line dislocations at a finite temperature. We derive analytical formulae for the number of hydrogen atoms forming the Cottrell atmosphere of a mesoscopic dislocation loop or an edge dislocation. The solubility of hydrogen as a function of temperature, pressure and the density of dislocations exhibits three physically distinct regimes, dominated by the solubility of hydrogen in a perfect lattice, its retention at dislocation cores, and trapping by long-range elastic fields of dislocations.