Check if a line is entirely inside a polygon

Hi guys,

I think I came up with a pathfinding algorithm. May not be the best, but I’d like to try to implement it.
The only problem is that it needs to check if a line is completely inside a polygon. It is not allowed to cross the edges even the littlest bit, touching them is ok though.

I can check on which side of a line a given point is, if a line intersects a polygon, basically everything, but brother Google couldn’t tell me how to check if a line is completely surrounded by a polygon.
Is there no possible way to accomplish this?

Thanks!